1 module directx.d2d1; 2 //--------------------------------------------------------------------------- 3 // Copyright (c) Microsoft Corporation. All rights reserved. 4 // 5 // This file is automatically generated. Please do not edit it directly. 6 // 7 // File name: D2D1.h 8 //--------------------------------------------------------------------------- 9 10 version(Windows): 11 12 13 version(Direct2D_1_3) 14 version = Direct2D_1_2; 15 version(Direct2D_1_2) 16 version = Direct2D_1_1; 17 version(Direct2D_1_1): 18 version = Direct2D_1_0; 19 20 version(DirectWrite): 21 version(Direct2D_1_0): 22 23 24 public import directx.dcommon; 25 public import directx.d2derr; 26 public import directx.d2dbasetypes; 27 public import directx.dxgi; 28 29 import directx.d3dcommon; 30 import directx.dwrite; 31 import directx.wincodec; 32 33 static if ( __traits(compiles, UINT32.sizeof) ) 34 { 35 } 36 else 37 { 38 alias UINT32 = uint; 39 } 40 41 alias UINT64 = ulong; // for D2D1_TAG 42 enum ULONGLONG_MAX = ulong.max; 43 enum D2D1_INVALID_TAG = ULONGLONG_MAX; 44 enum D2D1_DEFAULT_FLATTENING_TOLERANCE = 0.25f; 45 46 47 //+----------------------------------------------------------------------------- 48 // 49 // Enum: 50 // D2D1_INTERPOLATION_MODE_DEFINITION 51 // 52 // Synopsis: 53 // This defines the superset of interpolation mode supported by D2D APIs 54 // and built-in effects 55 // 56 //------------------------------------------------------------------------------ 57 enum 58 { 59 D2D1_INTERPOLATION_MODE_DEFINITION_NEAREST_NEIGHBOR = 0, 60 D2D1_INTERPOLATION_MODE_DEFINITION_LINEAR = 1, 61 D2D1_INTERPOLATION_MODE_DEFINITION_CUBIC = 2, 62 D2D1_INTERPOLATION_MODE_DEFINITION_MULTI_SAMPLE_LINEAR = 3, 63 D2D1_INTERPOLATION_MODE_DEFINITION_ANISOTROPIC = 4, 64 D2D1_INTERPOLATION_MODE_DEFINITION_HIGH_QUALITY_CUBIC = 5, 65 D2D1_INTERPOLATION_MODE_DEFINITION_FANT = 6, 66 D2D1_INTERPOLATION_MODE_DEFINITION_MIPMAP_LINEAR = 7 67 68 } 69 70 71 //+----------------------------------------------------------------------------- 72 // 73 // Enum: 74 // D2D1_GAMMA 75 // 76 // Synopsis: 77 // This determines what gamma is used for interpolation/blending. 78 // 79 //------------------------------------------------------------------------------ 80 alias D2D1_GAMMA = int; 81 enum : D2D1_GAMMA 82 { 83 84 // 85 // Colors are manipulated in 2.2 gamma color space. 86 // 87 D2D1_GAMMA_2_2 = 0, 88 89 // 90 // Colors are manipulated in 1.0 gamma color space. 91 // 92 D2D1_GAMMA_1_0 = 1, 93 D2D1_GAMMA_FORCE_DWORD = 0xffffffff 94 95 } 96 97 98 //+----------------------------------------------------------------------------- 99 // 100 // Enum: 101 // D2D1_OPACITY_MASK_CONTENT 102 // 103 // Synopsis: 104 // Specifies what the contents are of an opacity mask. 105 // 106 //------------------------------------------------------------------------------ 107 alias D2D1_OPACITY_MASK_CONTENT = int; 108 enum : D2D1_OPACITY_MASK_CONTENT 109 { 110 111 // 112 // The mask contains geometries or bitmaps. 113 // 114 D2D1_OPACITY_MASK_CONTENT_GRAPHICS = 0, 115 116 // 117 // The mask contains text rendered using one of the natural text modes. 118 // 119 D2D1_OPACITY_MASK_CONTENT_TEXT_NATURAL = 1, 120 121 // 122 // The mask contains text rendered using one of the GDI compatible text modes. 123 // 124 D2D1_OPACITY_MASK_CONTENT_TEXT_GDI_COMPATIBLE = 2, 125 D2D1_OPACITY_MASK_CONTENT_FORCE_DWORD = 0xffffffff 126 127 } 128 129 130 //+----------------------------------------------------------------------------- 131 // 132 // Enum: 133 // D2D1_EXTEND_MODE 134 // 135 // Synopsis: 136 // Enum which describes how to sample from a source outside its base tile. 137 // 138 //------------------------------------------------------------------------------ 139 alias D2D1_EXTEND_MODE = int; 140 enum : D2D1_EXTEND_MODE 141 { 142 143 // 144 // Extend the edges of the source out by clamping sample points outside the source 145 // to the edges. 146 // 147 D2D1_EXTEND_MODE_CLAMP = 0, 148 149 // 150 // The base tile is drawn untransformed and the remainder are filled by repeating 151 // the base tile. 152 // 153 D2D1_EXTEND_MODE_WRAP = 1, 154 155 // 156 // The same as wrap, but alternate tiles are flipped The base tile is drawn 157 // untransformed. 158 // 159 D2D1_EXTEND_MODE_MIRROR = 2, 160 D2D1_EXTEND_MODE_FORCE_DWORD = 0xffffffff 161 162 } 163 164 165 //+----------------------------------------------------------------------------- 166 // 167 // Enum: 168 // D2D1_ANTIALIAS_MODE 169 // 170 // Synopsis: 171 // Enum which describes the manner in which we render edges of non-text primitives. 172 // 173 //------------------------------------------------------------------------------ 174 alias D2D1_ANTIALIAS_MODE = int; 175 enum : D2D1_ANTIALIAS_MODE 176 { 177 178 // 179 // The edges of each primitive are antialiased sequentially. 180 // 181 D2D1_ANTIALIAS_MODE_PER_PRIMITIVE = 0, 182 183 // 184 // Each pixel is rendered if its pixel center is contained by the geometry. 185 // 186 D2D1_ANTIALIAS_MODE_ALIASED = 1, 187 D2D1_ANTIALIAS_MODE_FORCE_DWORD = 0xffffffff 188 189 } 190 191 192 //+----------------------------------------------------------------------------- 193 // 194 // Enum: 195 // D2D1_TEXT_ANTIALIAS_MODE 196 // 197 //------------------------------------------------------------------------------ 198 alias D2D1_TEXT_ANTIALIAS_MODE = int; 199 enum : D2D1_TEXT_ANTIALIAS_MODE 200 { 201 202 // 203 // Render text using the current system setting. 204 // 205 D2D1_TEXT_ANTIALIAS_MODE_DEFAULT = 0, 206 207 // 208 // Render text using ClearType. 209 // 210 D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE = 1, 211 212 // 213 // Render text using gray-scale. 214 // 215 D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE = 2, 216 217 // 218 // Render text aliased. 219 // 220 D2D1_TEXT_ANTIALIAS_MODE_ALIASED = 3, 221 D2D1_TEXT_ANTIALIAS_MODE_FORCE_DWORD = 0xffffffff 222 223 } 224 225 226 //+----------------------------------------------------------------------------- 227 // 228 // Enum: 229 // D2D1_BITMAP_INTERPOLATION_MODE 230 // 231 //------------------------------------------------------------------------------ 232 alias D2D1_BITMAP_INTERPOLATION_MODE = int; 233 enum : D2D1_BITMAP_INTERPOLATION_MODE 234 { 235 236 // 237 // Nearest Neighbor filtering. Also known as nearest pixel or nearest point 238 // sampling. 239 // 240 D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR = D2D1_INTERPOLATION_MODE_DEFINITION_NEAREST_NEIGHBOR, 241 242 // 243 // Linear filtering. 244 // 245 D2D1_BITMAP_INTERPOLATION_MODE_LINEAR = D2D1_INTERPOLATION_MODE_DEFINITION_LINEAR, 246 D2D1_BITMAP_INTERPOLATION_MODE_FORCE_DWORD = 0xffffffff 247 248 } 249 250 251 //+----------------------------------------------------------------------------- 252 // 253 // Flag: 254 // D2D1_DRAW_TEXT_OPTIONS 255 // 256 // Synopsis: 257 // Modifications made to the draw text call that influence how the text is 258 // rendered. 259 // 260 //------------------------------------------------------------------------------ 261 alias D2D1_DRAW_TEXT_OPTIONS = int; 262 enum : D2D1_DRAW_TEXT_OPTIONS 263 { 264 265 // 266 // Do not snap the baseline of the text vertically. 267 // 268 D2D1_DRAW_TEXT_OPTIONS_NO_SNAP = 0x00000001, 269 270 // 271 // Clip the text to the content bounds. 272 // 273 D2D1_DRAW_TEXT_OPTIONS_CLIP = 0x00000002, 274 275 // 276 // Render color versions of glyphs if defined by the font. 277 // 278 D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT = 0x00000004, 279 D2D1_DRAW_TEXT_OPTIONS_NONE = 0x00000000, 280 D2D1_DRAW_TEXT_OPTIONS_FORCE_DWORD = 0xffffffff 281 282 } 283 284 // TODO: translate this 285 //DEFINE_ENUM_FLAG_OPERATORS(D2D1_DRAW_TEXT_OPTIONS); 286 287 alias D2D1_POINT_2U = D2D_POINT_2U; 288 alias D2D1_POINT_2F = D2D_POINT_2F; 289 alias D2D1_RECT_F = D2D_RECT_F; 290 alias D2D1_RECT_U = D2D_RECT_U; 291 alias D2D1_SIZE_F = D2D_SIZE_F; 292 alias D2D1_SIZE_U = D2D_SIZE_U; 293 alias D2D1_COLOR_F = D2D_COLOR_F; 294 alias D2D1_MATRIX_3X2_F = D2D_MATRIX_3X2_F; 295 alias D2D1_TAG = UINT64; 296 297 //+----------------------------------------------------------------------------- 298 // 299 // Struct: 300 // D2D1_BITMAP_PROPERTIES 301 // 302 //------------------------------------------------------------------------------ 303 struct D2D1_BITMAP_PROPERTIES 304 { 305 D2D1_PIXEL_FORMAT pixelFormat; 306 FLOAT dpiX; 307 FLOAT dpiY; 308 } 309 310 311 //+----------------------------------------------------------------------------- 312 // 313 // Struct: 314 // D2D1_GRADIENT_STOP 315 // 316 //------------------------------------------------------------------------------ 317 struct D2D1_GRADIENT_STOP 318 { 319 FLOAT position; 320 D2D1_COLOR_F color; 321 322 } 323 324 325 //+----------------------------------------------------------------------------- 326 // 327 // Struct: 328 // D2D1_BRUSH_PROPERTIES 329 // 330 //------------------------------------------------------------------------------ 331 struct D2D1_BRUSH_PROPERTIES 332 { 333 FLOAT opacity; 334 D2D1_MATRIX_3X2_F transform; 335 336 } 337 338 339 //+----------------------------------------------------------------------------- 340 // 341 // Struct: 342 // D2D1_BITMAP_BRUSH_PROPERTIES 343 // 344 //------------------------------------------------------------------------------ 345 struct D2D1_BITMAP_BRUSH_PROPERTIES 346 { 347 D2D1_EXTEND_MODE extendModeX; 348 D2D1_EXTEND_MODE extendModeY; 349 D2D1_BITMAP_INTERPOLATION_MODE interpolationMode; 350 351 } 352 353 354 //+----------------------------------------------------------------------------- 355 // 356 // Struct: 357 // D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES 358 // 359 //------------------------------------------------------------------------------ 360 struct D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES 361 { 362 D2D1_POINT_2F startPoint; 363 D2D1_POINT_2F endPoint; 364 365 } 366 367 368 //+----------------------------------------------------------------------------- 369 // 370 // Struct: 371 // D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES 372 // 373 //------------------------------------------------------------------------------ 374 struct D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES 375 { 376 D2D1_POINT_2F center; 377 D2D1_POINT_2F gradientOriginOffset; 378 FLOAT radiusX; 379 FLOAT radiusY; 380 381 } 382 383 384 //+----------------------------------------------------------------------------- 385 // 386 // Enum: 387 // D2D1_ARC_SIZE 388 // 389 // Synopsis: 390 // Differentiates which of the two possible arcs could match the given arc 391 // parameters. 392 // 393 //------------------------------------------------------------------------------ 394 alias D2D1_ARC_SIZE = int; 395 enum : D2D1_ARC_SIZE 396 { 397 D2D1_ARC_SIZE_SMALL = 0, 398 D2D1_ARC_SIZE_LARGE = 1, 399 D2D1_ARC_SIZE_FORCE_DWORD = 0xffffffff 400 401 } 402 403 404 //+----------------------------------------------------------------------------- 405 // 406 // Enum: 407 // D2D1_CAP_STYLE 408 // 409 // Synopsis: 410 // Enum which describes the drawing of the ends of a line. 411 // 412 //------------------------------------------------------------------------------ 413 alias D2D1_CAP_STYLE = int; 414 enum : D2D1_CAP_STYLE 415 { 416 417 // 418 // Flat line cap. 419 // 420 D2D1_CAP_STYLE_FLAT = 0, 421 422 // 423 // Square line cap. 424 // 425 D2D1_CAP_STYLE_SQUARE = 1, 426 427 // 428 // Round line cap. 429 // 430 D2D1_CAP_STYLE_ROUND = 2, 431 432 // 433 // Triangle line cap. 434 // 435 D2D1_CAP_STYLE_TRIANGLE = 3, 436 D2D1_CAP_STYLE_FORCE_DWORD = 0xffffffff 437 438 } 439 440 441 //+----------------------------------------------------------------------------- 442 // 443 // Enum: 444 // D2D1_DASH_STYLE 445 // 446 //------------------------------------------------------------------------------ 447 alias D2D1_DASH_STYLE = int; 448 enum : D2D1_DASH_STYLE 449 { 450 D2D1_DASH_STYLE_SOLID = 0, 451 D2D1_DASH_STYLE_DASH = 1, 452 D2D1_DASH_STYLE_DOT = 2, 453 D2D1_DASH_STYLE_DASH_DOT = 3, 454 D2D1_DASH_STYLE_DASH_DOT_DOT = 4, 455 D2D1_DASH_STYLE_CUSTOM = 5, 456 D2D1_DASH_STYLE_FORCE_DWORD = 0xffffffff 457 458 } 459 460 461 //+----------------------------------------------------------------------------- 462 // 463 // Enum: 464 // D2D1_LINE_JOIN 465 // 466 // Synopsis: 467 // Enum which describes the drawing of the corners on the line. 468 // 469 //------------------------------------------------------------------------------ 470 alias D2D1_LINE_JOIN = int; 471 enum : D2D1_LINE_JOIN 472 { 473 474 // 475 // Miter join. 476 // 477 D2D1_LINE_JOIN_MITER = 0, 478 479 // 480 // Bevel join. 481 // 482 D2D1_LINE_JOIN_BEVEL = 1, 483 484 // 485 // Round join. 486 // 487 D2D1_LINE_JOIN_ROUND = 2, 488 489 // 490 // Miter/Bevel join. 491 // 492 D2D1_LINE_JOIN_MITER_OR_BEVEL = 3, 493 D2D1_LINE_JOIN_FORCE_DWORD = 0xffffffff 494 495 } 496 497 498 //+----------------------------------------------------------------------------- 499 // 500 // Enum: 501 // D2D1_COMBINE_MODE 502 // 503 // Synopsis: 504 // This enumeration describes the type of combine operation to be performed. 505 // 506 //------------------------------------------------------------------------------ 507 alias D2D1_COMBINE_MODE = int; 508 enum : D2D1_COMBINE_MODE 509 { 510 511 // 512 // Produce a geometry representing the set of points contained in either 513 // the first or the second geometry. 514 // 515 D2D1_COMBINE_MODE_UNION = 0, 516 517 // 518 // Produce a geometry representing the set of points common to the first 519 // and the second geometries. 520 // 521 D2D1_COMBINE_MODE_INTERSECT = 1, 522 523 // 524 // Produce a geometry representing the set of points contained in the 525 // first geometry or the second geometry, but not both. 526 // 527 D2D1_COMBINE_MODE_XOR = 2, 528 529 // 530 // Produce a geometry representing the set of points contained in the 531 // first geometry but not the second geometry. 532 // 533 D2D1_COMBINE_MODE_EXCLUDE = 3, 534 D2D1_COMBINE_MODE_FORCE_DWORD = 0xffffffff 535 536 } 537 538 539 //+----------------------------------------------------------------------------- 540 // 541 // Enum: 542 // D2D1_GEOMETRY_RELATION 543 // 544 //------------------------------------------------------------------------------ 545 alias D2D1_GEOMETRY_RELATION = int; 546 enum : D2D1_GEOMETRY_RELATION 547 { 548 549 // 550 // The relation between the geometries couldn't be determined. This value is never 551 // returned by any D2D method. 552 // 553 D2D1_GEOMETRY_RELATION_UNKNOWN = 0, 554 555 // 556 // The two geometries do not intersect at all. 557 // 558 D2D1_GEOMETRY_RELATION_DISJOINT = 1, 559 560 // 561 // The passed in geometry is entirely contained by the object. 562 // 563 D2D1_GEOMETRY_RELATION_IS_CONTAINED = 2, 564 565 // 566 // The object entirely contains the passed in geometry. 567 // 568 D2D1_GEOMETRY_RELATION_CONTAINS = 3, 569 570 // 571 // The two geometries overlap but neither completely contains the other. 572 // 573 D2D1_GEOMETRY_RELATION_OVERLAP = 4, 574 D2D1_GEOMETRY_RELATION_FORCE_DWORD = 0xffffffff 575 576 } 577 578 579 //+----------------------------------------------------------------------------- 580 // 581 // Enum: 582 // D2D1_GEOMETRY_SIMPLIFICATION_OPTION 583 // 584 // Synopsis: 585 // Specifies how simple the output of a simplified geometry sink should be. 586 // 587 //------------------------------------------------------------------------------ 588 alias D2D1_GEOMETRY_SIMPLIFICATION_OPTION = int; 589 enum : D2D1_GEOMETRY_SIMPLIFICATION_OPTION 590 { 591 D2D1_GEOMETRY_SIMPLIFICATION_OPTION_CUBICS_AND_LINES = 0, 592 D2D1_GEOMETRY_SIMPLIFICATION_OPTION_LINES = 1, 593 D2D1_GEOMETRY_SIMPLIFICATION_OPTION_FORCE_DWORD = 0xffffffff 594 595 } 596 597 598 //+----------------------------------------------------------------------------- 599 // 600 // Enum: 601 // D2D1_FIGURE_BEGIN 602 // 603 // Synopsis: 604 // Indicates whether the given figure is filled or hollow. 605 // 606 //------------------------------------------------------------------------------ 607 alias D2D1_FIGURE_BEGIN = int; 608 enum : D2D1_FIGURE_BEGIN 609 { 610 D2D1_FIGURE_BEGIN_FILLED = 0, 611 D2D1_FIGURE_BEGIN_HOLLOW = 1, 612 D2D1_FIGURE_BEGIN_FORCE_DWORD = 0xffffffff 613 614 } 615 616 617 //+----------------------------------------------------------------------------- 618 // 619 // Enum: 620 // D2D1_FIGURE_END 621 // 622 // Synopsis: 623 // Indicates whether the figure is open or closed on its end point. 624 // 625 //------------------------------------------------------------------------------ 626 alias D2D1_FIGURE_END = int; 627 enum : D2D1_FIGURE_END 628 { 629 D2D1_FIGURE_END_OPEN = 0, 630 D2D1_FIGURE_END_CLOSED = 1, 631 D2D1_FIGURE_END_FORCE_DWORD = 0xffffffff 632 633 } 634 635 636 //+----------------------------------------------------------------------------- 637 // 638 // Struct: 639 // D2D1_BEZIER_SEGMENT 640 // 641 // Synopsis: 642 // Describes a cubic bezier in a path. 643 // 644 //------------------------------------------------------------------------------ 645 struct D2D1_BEZIER_SEGMENT 646 { 647 D2D1_POINT_2F point1; 648 D2D1_POINT_2F point2; 649 D2D1_POINT_2F point3; 650 651 } 652 653 654 //+----------------------------------------------------------------------------- 655 // 656 // Struct: 657 // D2D1_TRIANGLE 658 // 659 // Synopsis: 660 // Describes a triangle. 661 // 662 //------------------------------------------------------------------------------ 663 struct D2D1_TRIANGLE 664 { 665 D2D1_POINT_2F point1; 666 D2D1_POINT_2F point2; 667 D2D1_POINT_2F point3; 668 669 } 670 671 672 //+----------------------------------------------------------------------------- 673 // 674 // Flag: 675 // D2D1_PATH_SEGMENT 676 // 677 // Synopsis: 678 // Indicates whether the given segment should be stroked, or, if the join between 679 // this segment and the previous one should be smooth. 680 // 681 //------------------------------------------------------------------------------ 682 alias D2D1_PATH_SEGMENT = int; 683 enum : D2D1_PATH_SEGMENT 684 { 685 D2D1_PATH_SEGMENT_NONE = 0x00000000, 686 D2D1_PATH_SEGMENT_FORCE_UNSTROKED = 0x00000001, 687 D2D1_PATH_SEGMENT_FORCE_ROUND_LINE_JOIN = 0x00000002, 688 D2D1_PATH_SEGMENT_FORCE_DWORD = 0xffffffff 689 690 } 691 692 // TODO: translate this 693 //DEFINE_ENUM_FLAG_OPERATORS(D2D1_PATH_SEGMENT); 694 695 696 //+----------------------------------------------------------------------------- 697 // 698 // Enum: 699 // D2D1_SWEEP_DIRECTION 700 // 701 //------------------------------------------------------------------------------ 702 alias D2D1_SWEEP_DIRECTION = int; 703 enum : D2D1_SWEEP_DIRECTION 704 { 705 D2D1_SWEEP_DIRECTION_COUNTER_CLOCKWISE = 0, 706 D2D1_SWEEP_DIRECTION_CLOCKWISE = 1, 707 D2D1_SWEEP_DIRECTION_FORCE_DWORD = 0xffffffff 708 709 } 710 711 712 //+----------------------------------------------------------------------------- 713 // 714 // Enum: 715 // D2D1_FILL_MODE 716 // 717 //------------------------------------------------------------------------------ 718 alias D2D1_FILL_MODE = int; 719 enum : D2D1_FILL_MODE 720 { 721 D2D1_FILL_MODE_ALTERNATE = 0, 722 D2D1_FILL_MODE_WINDING = 1, 723 D2D1_FILL_MODE_FORCE_DWORD = 0xffffffff 724 725 } 726 727 728 //+----------------------------------------------------------------------------- 729 // 730 // Struct: 731 // D2D1_ARC_SEGMENT 732 // 733 // Synopsis: 734 // Describes an arc that is defined as part of a path. 735 // 736 //------------------------------------------------------------------------------ 737 struct D2D1_ARC_SEGMENT 738 { 739 D2D1_POINT_2F point; 740 D2D1_SIZE_F size; 741 FLOAT rotationAngle; 742 D2D1_SWEEP_DIRECTION sweepDirection; 743 D2D1_ARC_SIZE arcSize; 744 745 } 746 747 748 //+----------------------------------------------------------------------------- 749 // 750 // Struct: 751 // D2D1_QUADRATIC_BEZIER_SEGMENT 752 // 753 //------------------------------------------------------------------------------ 754 struct D2D1_QUADRATIC_BEZIER_SEGMENT 755 { 756 D2D1_POINT_2F point1; 757 D2D1_POINT_2F point2; 758 759 } 760 761 762 //+----------------------------------------------------------------------------- 763 // 764 // Struct: 765 // D2D1_ELLIPSE 766 // 767 //------------------------------------------------------------------------------ 768 struct D2D1_ELLIPSE 769 { 770 D2D1_POINT_2F point; 771 FLOAT radiusX; 772 FLOAT radiusY; 773 774 } 775 776 777 //+----------------------------------------------------------------------------- 778 // 779 // Struct: 780 // D2D1_ROUNDED_RECT 781 // 782 //------------------------------------------------------------------------------ 783 struct D2D1_ROUNDED_RECT 784 { 785 D2D1_RECT_F rect; 786 FLOAT radiusX; 787 FLOAT radiusY; 788 789 } 790 791 792 //+----------------------------------------------------------------------------- 793 // 794 // Struct: 795 // D2D1_STROKE_STYLE_PROPERTIES 796 // 797 // Synopsis: 798 // Properties, aside from the width, that allow geometric penning to be specified. 799 // 800 //------------------------------------------------------------------------------ 801 struct D2D1_STROKE_STYLE_PROPERTIES 802 { 803 D2D1_CAP_STYLE startCap; 804 D2D1_CAP_STYLE endCap; 805 D2D1_CAP_STYLE dashCap; 806 D2D1_LINE_JOIN lineJoin; 807 FLOAT miterLimit; 808 D2D1_DASH_STYLE dashStyle; 809 FLOAT dashOffset; 810 811 } 812 813 814 //+----------------------------------------------------------------------------- 815 // 816 // Flag: 817 // D2D1_LAYER_OPTIONS 818 // 819 // Synopsis: 820 // Specified options that can be applied when a layer resource is applied to create 821 // a layer. 822 // 823 //------------------------------------------------------------------------------ 824 alias D2D1_LAYER_OPTIONS = int; 825 enum : D2D1_LAYER_OPTIONS 826 { 827 D2D1_LAYER_OPTIONS_NONE = 0x00000000, 828 829 // 830 // The layer will render correctly for ClearType text. If the render target was set 831 // to ClearType previously, the layer will continue to render ClearType. If the 832 // render target was set to ClearType and this option is not specified, the render 833 // target will be set to render gray-scale until the layer is popped. The caller 834 // can override this default by calling SetTextAntialiasMode while within the 835 // layer. This flag is slightly slower than the default. 836 // 837 D2D1_LAYER_OPTIONS_INITIALIZE_FOR_CLEARTYPE = 0x00000001, 838 D2D1_LAYER_OPTIONS_FORCE_DWORD = 0xffffffff 839 840 } 841 842 // TODO: translate this 843 //DEFINE_ENUM_FLAG_OPERATORS(D2D1_LAYER_OPTIONS); 844 845 846 //+----------------------------------------------------------------------------- 847 // 848 // Struct: 849 // D2D1_LAYER_PARAMETERS 850 // 851 //------------------------------------------------------------------------------ 852 struct D2D1_LAYER_PARAMETERS 853 { 854 855 // 856 // The rectangular clip that will be applied to the layer. The clip is affected by 857 // the world transform. Content outside of the content bounds will not render. 858 // 859 D2D1_RECT_F contentBounds; 860 861 // 862 // A general mask that can be optionally applied to the content. Content not inside 863 // the fill of the mask will not be rendered. 864 // 865 ID2D1Geometry geometricMask; // 1-byte aligned? 866 867 // 868 // Specifies whether the mask should be aliased or antialiased. 869 // 870 D2D1_ANTIALIAS_MODE maskAntialiasMode; 871 872 // 873 // An additional transform that may be applied to the mask in addition to the 874 // current world transform. 875 // 876 D2D1_MATRIX_3X2_F maskTransform; 877 878 // 879 // The opacity with which all of the content in the layer will be blended back to 880 // the target when the layer is popped. 881 // 882 FLOAT opacity; 883 884 // 885 // An additional brush that can be applied to the layer. Only the opacity channel 886 // is sampled from this brush and multiplied both with the layer content and the 887 // over-all layer opacity. 888 // 889 ID2D1Brush opacityBrush; // 1-byte aligned? 890 891 // 892 // Specifies if ClearType will be rendered into the layer. 893 // 894 D2D1_LAYER_OPTIONS layerOptions; 895 896 } 897 898 899 //+----------------------------------------------------------------------------- 900 // 901 // Flag: 902 // D2D1_WINDOW_STATE 903 // 904 //------------------------------------------------------------------------------ 905 alias D2D1_WINDOW_STATE = int; 906 enum : D2D1_WINDOW_STATE 907 { 908 D2D1_WINDOW_STATE_NONE = 0x0000000, 909 D2D1_WINDOW_STATE_OCCLUDED = 0x0000001, 910 D2D1_WINDOW_STATE_FORCE_DWORD = 0xffffffff 911 912 } 913 914 // TODO: translate this 915 //DEFINE_ENUM_FLAG_OPERATORS(D2D1_WINDOW_STATE); 916 917 918 //+----------------------------------------------------------------------------- 919 // 920 // Enum: 921 // D2D1_RENDER_TARGET_TYPE 922 // 923 //------------------------------------------------------------------------------ 924 alias D2D1_RENDER_TARGET_TYPE = int; 925 enum : D2D1_RENDER_TARGET_TYPE 926 { 927 928 // 929 // D2D is free to choose the render target type for the caller. 930 // 931 D2D1_RENDER_TARGET_TYPE_DEFAULT = 0, 932 933 // 934 // The render target will render using the CPU. 935 // 936 D2D1_RENDER_TARGET_TYPE_SOFTWARE = 1, 937 938 // 939 // The render target will render using the GPU. 940 // 941 D2D1_RENDER_TARGET_TYPE_HARDWARE = 2, 942 D2D1_RENDER_TARGET_TYPE_FORCE_DWORD = 0xffffffff 943 944 } 945 946 947 //+----------------------------------------------------------------------------- 948 // 949 // Enum: 950 // D2D1_FEATURE_LEVEL 951 // 952 //------------------------------------------------------------------------------ 953 alias D2D1_FEATURE_LEVEL = int; 954 enum : D2D1_FEATURE_LEVEL 955 { 956 957 // 958 // The caller does not require a particular underlying D3D device level. 959 // 960 D2D1_FEATURE_LEVEL_DEFAULT = 0, 961 962 // 963 // The D3D device level is DX9 compatible. 964 // 965 D2D1_FEATURE_LEVEL_9 = D3D_FEATURE_LEVEL_9_1, 966 967 // 968 // The D3D device level is DX10 compatible. 969 // 970 D2D1_FEATURE_LEVEL_10 = D3D_FEATURE_LEVEL_10_0, 971 D2D1_FEATURE_LEVEL_FORCE_DWORD = 0xffffffff 972 973 } 974 975 976 //+----------------------------------------------------------------------------- 977 // 978 // Flag: 979 // D2D1_RENDER_TARGET_USAGE 980 // 981 //------------------------------------------------------------------------------ 982 alias D2D1_RENDER_TARGET_USAGE = int; 983 enum : D2D1_RENDER_TARGET_USAGE 984 { 985 D2D1_RENDER_TARGET_USAGE_NONE = 0x00000000, 986 987 // 988 // Rendering will occur locally, if a terminal-services session is established, the 989 // bitmap updates will be sent to the terminal services client. 990 // 991 D2D1_RENDER_TARGET_USAGE_FORCE_BITMAP_REMOTING = 0x00000001, 992 993 // 994 // The render target will allow a call to GetDC on the ID2D1GdiInteropRenderTarget 995 // interface. Rendering will also occur locally. 996 // 997 D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE = 0x00000002, 998 D2D1_RENDER_TARGET_USAGE_FORCE_DWORD = 0xffffffff 999 1000 } 1001 1002 // TODO: translate this 1003 //DEFINE_ENUM_FLAG_OPERATORS(D2D1_RENDER_TARGET_USAGE); 1004 1005 1006 //+----------------------------------------------------------------------------- 1007 // 1008 // Flag: 1009 // D2D1_PRESENT_OPTIONS 1010 // 1011 // Synopsis: 1012 // Describes how present should behave. 1013 // 1014 //------------------------------------------------------------------------------ 1015 alias D2D1_PRESENT_OPTIONS = int; 1016 enum : D2D1_PRESENT_OPTIONS 1017 { 1018 D2D1_PRESENT_OPTIONS_NONE = 0x00000000, 1019 1020 // 1021 // Keep the target contents intact through present. 1022 // 1023 D2D1_PRESENT_OPTIONS_RETAIN_CONTENTS = 0x00000001, 1024 1025 // 1026 // Do not wait for display refresh to commit changes to display. 1027 // 1028 D2D1_PRESENT_OPTIONS_IMMEDIATELY = 0x00000002, 1029 D2D1_PRESENT_OPTIONS_FORCE_DWORD = 0xffffffff 1030 1031 } 1032 1033 // TODO: translate this 1034 //DEFINE_ENUM_FLAG_OPERATORS(D2D1_PRESENT_OPTIONS); 1035 1036 1037 //+----------------------------------------------------------------------------- 1038 // 1039 // Struct: 1040 // D2D1_RENDER_TARGET_PROPERTIES 1041 // 1042 //------------------------------------------------------------------------------ 1043 struct D2D1_RENDER_TARGET_PROPERTIES 1044 { 1045 D2D1_RENDER_TARGET_TYPE type; 1046 D2D1_PIXEL_FORMAT pixelFormat; 1047 FLOAT dpiX; 1048 FLOAT dpiY; 1049 D2D1_RENDER_TARGET_USAGE usage; 1050 D2D1_FEATURE_LEVEL minLevel; 1051 1052 } 1053 1054 1055 //+----------------------------------------------------------------------------- 1056 // 1057 // Struct: 1058 // D2D1_HWND_RENDER_TARGET_PROPERTIES 1059 // 1060 //------------------------------------------------------------------------------ 1061 struct D2D1_HWND_RENDER_TARGET_PROPERTIES 1062 { 1063 HWND hwnd; 1064 D2D1_SIZE_U pixelSize; 1065 D2D1_PRESENT_OPTIONS presentOptions; 1066 1067 } 1068 1069 1070 //+----------------------------------------------------------------------------- 1071 // 1072 // Flag: 1073 // D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS 1074 // 1075 //------------------------------------------------------------------------------ 1076 alias D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS = int; 1077 enum : D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS 1078 { 1079 D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE = 0x00000000, 1080 1081 // 1082 // The compatible render target will allow a call to GetDC on the 1083 // ID2D1GdiInteropRenderTarget interface. This can be specified even if the parent 1084 // render target is not GDI compatible. 1085 // 1086 D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_GDI_COMPATIBLE = 0x00000001, 1087 D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_FORCE_DWORD = 0xffffffff 1088 1089 } 1090 1091 // TODO: translate this 1092 //DEFINE_ENUM_FLAG_OPERATORS(D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS); 1093 1094 1095 //+----------------------------------------------------------------------------- 1096 // 1097 // Struct: 1098 // D2D1_DRAWING_STATE_DESCRIPTION 1099 // 1100 // Synopsis: 1101 // Allows the drawing state to be atomically created. This also specifies the 1102 // drawing state that is saved into an IDrawingStateBlock object. 1103 // 1104 //------------------------------------------------------------------------------ 1105 struct D2D1_DRAWING_STATE_DESCRIPTION 1106 { 1107 D2D1_ANTIALIAS_MODE antialiasMode; 1108 D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode; 1109 D2D1_TAG tag1; 1110 D2D1_TAG tag2; 1111 D2D1_MATRIX_3X2_F transform; 1112 1113 } 1114 1115 1116 //+----------------------------------------------------------------------------- 1117 // 1118 // Enum: 1119 // D2D1_DC_INITIALIZE_MODE 1120 // 1121 //------------------------------------------------------------------------------ 1122 alias D2D1_DC_INITIALIZE_MODE = int; 1123 enum : D2D1_DC_INITIALIZE_MODE 1124 { 1125 1126 // 1127 // The contents of the D2D render target will be copied to the DC. 1128 // 1129 D2D1_DC_INITIALIZE_MODE_COPY = 0, 1130 1131 // 1132 // The contents of the DC will be cleared. 1133 // 1134 D2D1_DC_INITIALIZE_MODE_CLEAR = 1, 1135 D2D1_DC_INITIALIZE_MODE_FORCE_DWORD = 0xffffffff 1136 1137 } 1138 1139 1140 //+----------------------------------------------------------------------------- 1141 // 1142 // Enum: 1143 // D2D1_DEBUG_LEVEL 1144 // 1145 // Synopsis: 1146 // Indicates the debug level to be output by the debug layer. 1147 // 1148 //------------------------------------------------------------------------------ 1149 alias D2D1_DEBUG_LEVEL = int; 1150 enum : D2D1_DEBUG_LEVEL 1151 { 1152 D2D1_DEBUG_LEVEL_NONE = 0, 1153 D2D1_DEBUG_LEVEL_ERROR = 1, 1154 D2D1_DEBUG_LEVEL_WARNING = 2, 1155 D2D1_DEBUG_LEVEL_INFORMATION = 3, 1156 D2D1_DEBUG_LEVEL_FORCE_DWORD = 0xffffffff 1157 1158 } 1159 1160 1161 //+----------------------------------------------------------------------------- 1162 // 1163 // Enum: 1164 // D2D1_FACTORY_TYPE 1165 // 1166 // Synopsis: 1167 // Specifies the threading model of the created factory and all of its derived 1168 // resources. 1169 // 1170 //------------------------------------------------------------------------------ 1171 alias D2D1_FACTORY_TYPE = int; 1172 enum : D2D1_FACTORY_TYPE 1173 { 1174 1175 // 1176 // The resulting factory and derived resources may only be invoked serially. 1177 // Reference counts on resources are interlocked, however, resource and render 1178 // target state is not protected from multi-threaded access. 1179 // 1180 D2D1_FACTORY_TYPE_SINGLE_THREADED = 0, 1181 1182 // 1183 // The resulting factory may be invoked from multiple threads. Returned resources 1184 // use interlocked reference counting and their state is protected. 1185 // 1186 D2D1_FACTORY_TYPE_MULTI_THREADED = 1, 1187 D2D1_FACTORY_TYPE_FORCE_DWORD = 0xffffffff 1188 1189 } 1190 1191 1192 //+----------------------------------------------------------------------------- 1193 // 1194 // Struct: 1195 // D2D1_FACTORY_OPTIONS 1196 // 1197 // Synopsis: 1198 // Allows additional parameters for factory creation. 1199 // 1200 //------------------------------------------------------------------------------ 1201 struct D2D1_FACTORY_OPTIONS 1202 { 1203 1204 // 1205 // Requests a certain level of debugging information from the debug layer. This 1206 // parameter is ignored if the debug layer DLL is not present. 1207 // 1208 D2D1_DEBUG_LEVEL debugLevel; 1209 1210 } 1211 1212 1213 //#endif /* WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) */ 1214 1215 1216 1217 1218 //#pragma region Application Family 1219 //#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) 1220 1221 1222 //+----------------------------------------------------------------------------- 1223 // 1224 // Interface: 1225 // ID2D1Resource 1226 // 1227 // Synopsis: 1228 // The root interface for all resources in D2D. 1229 // 1230 //------------------------------------------------------------------------------ 1231 mixin( uuid!(ID2D1Resource, "2cd90691-12e2-11dc-9fed-001143a055f9") ); 1232 interface ID2D1Resource : IUnknown 1233 { 1234 extern(Windows): 1235 1236 // 1237 // Retrieve the factory associated with this resource. 1238 // 1239 void GetFactory( ID2D1Factory* factory ) const; 1240 } // interface ID2D1Resource 1241 1242 1243 1244 //+----------------------------------------------------------------------------- 1245 // 1246 // Interface: 1247 // ID2D1Image 1248 // 1249 //------------------------------------------------------------------------------ 1250 mixin( uuid!(ID2D1Image, "65019f75-8da2-497c-b32c-dfa34e48ede6") ); 1251 interface ID2D1Image : ID2D1Resource 1252 { 1253 extern(Windows): 1254 } // interface ID2D1Image 1255 1256 1257 1258 //+----------------------------------------------------------------------------- 1259 // 1260 // Interface: 1261 // ID2D1Bitmap 1262 // 1263 // Synopsis: 1264 // Root bitmap resource, linearly scaled on a draw call. 1265 // 1266 //------------------------------------------------------------------------------ 1267 mixin( uuid!(ID2D1Bitmap, "a2296057-ea42-4099-983b-539fb6505426") ); 1268 interface ID2D1Bitmap : ID2D1Image 1269 { 1270 extern(Windows): 1271 1272 // 1273 // Returns the size of the bitmap in resolution independent units. 1274 // 1275 // BUG: got crash? see ID2D1RenderTarget.GetSize() 1276 ref D2D1_SIZE_F GetSize() const; 1277 1278 1279 // 1280 // Returns the size of the bitmap in resolution dependent units, (pixels). 1281 // 1282 // BUG: got crash? see ID2D1RenderTarget.GetSize() 1283 ref D2D1_SIZE_U GetPixelSize() const; 1284 1285 1286 // 1287 // Retrieve the format of the bitmap. 1288 // 1289 // BUG: got crash? see ID2D1RenderTarget.GetSize() 1290 ref D2D1_PIXEL_FORMAT GetPixelFormat() const; 1291 1292 1293 // 1294 // Return the DPI of the bitmap. 1295 // 1296 void GetDpi(out FLOAT dpiX, out FLOAT dpiY ) const; 1297 1298 HRESULT CopyFromBitmap( 1299 const(D2D1_POINT_2U)* destPoint, 1300 ID2D1Bitmap bitmap, 1301 const(D2D1_RECT_U)* srcRect 1302 ); 1303 1304 HRESULT CopyFromRenderTarget( 1305 const(D2D1_POINT_2U)* destPoint, 1306 ID2D1RenderTarget renderTarget, 1307 const(D2D1_RECT_U)* srcRect 1308 ); 1309 1310 HRESULT CopyFromMemory( 1311 const(D2D1_RECT_U)* dstRect, 1312 const(void*) srcData, 1313 UINT32 pitch 1314 ); 1315 } // interface ID2D1Bitmap 1316 1317 1318 1319 //+----------------------------------------------------------------------------- 1320 // 1321 // Interface: 1322 // ID2D1GradientStopCollection 1323 // 1324 // Synopsis: 1325 // Represents an collection of gradient stops that can then be the source resource 1326 // for either a linear or radial gradient brush. 1327 // 1328 //------------------------------------------------------------------------------ 1329 mixin( uuid!(ID2D1GradientStopCollection, "2cd906a7-12e2-11dc-9fed-001143a055f9") ); 1330 interface ID2D1GradientStopCollection : ID2D1Resource 1331 { 1332 extern(Windows): 1333 1334 // 1335 // Returns the number of stops in the gradient. 1336 // 1337 UINT32 GetGradientStopCount() const; 1338 1339 1340 // 1341 // Copies the gradient stops from the collection into the caller's interface. The 1342 // returned colors have straight alpha. 1343 // 1344 void GetGradientStops( 1345 D2D1_GRADIENT_STOP* gradientStops, 1346 UINT32 gradientStopsCount 1347 ) const; 1348 1349 1350 // 1351 // Returns whether the interpolation occurs with 1.0 or 2.2 gamma. 1352 // 1353 D2D1_GAMMA GetColorInterpolationGamma() const; 1354 1355 D2D1_EXTEND_MODE GetExtendMode() const; 1356 } // interface ID2D1GradientStopCollection 1357 1358 1359 1360 //+----------------------------------------------------------------------------- 1361 // 1362 // Interface: 1363 // ID2D1Brush 1364 // 1365 // Synopsis: 1366 // The root brush interface. All brushes can be used to fill or pen a geometry. 1367 // 1368 //------------------------------------------------------------------------------ 1369 mixin( uuid!(ID2D1Brush, "2cd906a8-12e2-11dc-9fed-001143a055f9") ); 1370 interface ID2D1Brush : ID2D1Resource 1371 { 1372 extern(Windows): 1373 1374 // 1375 // Sets the opacity for when the brush is drawn over the entire fill of the brush. 1376 // 1377 void SetOpacity( FLOAT opacity ); 1378 1379 1380 // 1381 // Sets the transform that applies to everything drawn by the brush. 1382 // 1383 void SetTransform( const(D2D1_MATRIX_3X2_F)* transform ); 1384 1385 FLOAT GetOpacity() const; 1386 1387 void GetTransform( /*out*/ D2D1_MATRIX_3X2_F* transform ) const; 1388 1389 /*COM_DECLSPEC_NOTHROW 1390 void 1391 SetTransform( 1392 CONST D2D1_MATRIX_3X2_F &transform 1393 ) 1394 { 1395 SetTransform(&transform); 1396 } 1397 */ 1398 } // interface ID2D1Brush 1399 1400 1401 1402 //+----------------------------------------------------------------------------- 1403 // 1404 // Interface: 1405 // ID2D1BitmapBrush 1406 // 1407 // Synopsis: 1408 // A bitmap brush allows a bitmap to be used to fill a geometry. 1409 // 1410 //------------------------------------------------------------------------------ 1411 mixin( uuid!(ID2D1BitmapBrush, "2cd906aa-12e2-11dc-9fed-001143a055f9") ); 1412 interface ID2D1BitmapBrush : ID2D1Brush 1413 { 1414 extern(Windows): 1415 1416 // 1417 // Sets how the bitmap is to be treated outside of its natural extent on the X 1418 // axis. 1419 // 1420 void SetExtendModeX( D2D1_EXTEND_MODE extendModeX ); 1421 1422 1423 // 1424 // Sets how the bitmap is to be treated outside of its natural extent on the X 1425 // axis. 1426 // 1427 void SetExtendModeY( D2D1_EXTEND_MODE extendModeY ); 1428 1429 1430 // 1431 // Sets the interpolation mode used when this brush is used. 1432 // 1433 void SetInterpolationMode( D2D1_BITMAP_INTERPOLATION_MODE interpolationMode ); 1434 1435 1436 // 1437 // Sets the bitmap associated as the source of this brush. 1438 // 1439 void SetBitmap( ID2D1Bitmap bitmap ); 1440 1441 D2D1_EXTEND_MODE GetExtendModeX() const; 1442 1443 D2D1_EXTEND_MODE GetExtendModeY() const; 1444 1445 D2D1_BITMAP_INTERPOLATION_MODE GetInterpolationMode() const; 1446 1447 void GetBitmap( out ID2D1Bitmap *bitmap ) const; 1448 } // interface ID2D1BitmapBrush 1449 1450 1451 1452 //+----------------------------------------------------------------------------- 1453 // 1454 // Interface: 1455 // ID2D1SolidColorBrush 1456 // 1457 //------------------------------------------------------------------------------ 1458 mixin( uuid!(ID2D1SolidColorBrush, "2cd906a9-12e2-11dc-9fed-001143a055f9") ); 1459 interface ID2D1SolidColorBrush : ID2D1Brush 1460 { 1461 extern(Windows): 1462 1463 void SetColor( const(D2D1_COLOR_F)* color ); 1464 1465 // BUG: got crash? see ID2D1RenderTarget.GetSize() 1466 ref D2D1_COLOR_F GetColor() const; 1467 1468 /* 1469 COM_DECLSPEC_NOTHROW 1470 void 1471 SetColor( 1472 CONST D2D1_COLOR_F &color 1473 ) 1474 { 1475 SetColor(&color); 1476 } 1477 */ 1478 } // interface ID2D1SolidColorBrush 1479 1480 1481 1482 //+----------------------------------------------------------------------------- 1483 // 1484 // Interface: 1485 // ID2D1LinearGradientBrush 1486 // 1487 //------------------------------------------------------------------------------ 1488 mixin( uuid!(ID2D1LinearGradientBrush, "2cd906ab-12e2-11dc-9fed-001143a055f9") ); 1489 interface ID2D1LinearGradientBrush : ID2D1Brush 1490 { 1491 extern(Windows): 1492 1493 void SetStartPoint( D2D1_POINT_2F startPoint ); 1494 1495 1496 // 1497 // Sets the end point of the gradient in local coordinate space. This is not 1498 // influenced by the geometry being filled. 1499 // 1500 void SetEndPoint( D2D1_POINT_2F endPoint ); 1501 1502 // BUG: got crash? see ID2D1RenderTarget.GetSize() 1503 ref D2D1_POINT_2F GetStartPoint() const; 1504 1505 // BUG: got crash? see ID2D1RenderTarget.GetSize() 1506 ref D2D1_POINT_2F GetEndPoint() const; 1507 1508 void GetGradientStopCollection( 1509 /*out*/ ID2D1GradientStopCollection *gradientStopCollection 1510 ) const; 1511 } // interface ID2D1LinearGradientBrush 1512 1513 1514 1515 //+----------------------------------------------------------------------------- 1516 // 1517 // Interface: 1518 // ID2D1RadialGradientBrush 1519 // 1520 //------------------------------------------------------------------------------ 1521 mixin( uuid!(ID2D1RadialGradientBrush, "2cd906ac-12e2-11dc-9fed-001143a055f9") ); 1522 interface ID2D1RadialGradientBrush : ID2D1Brush 1523 { 1524 extern(Windows): 1525 1526 // 1527 // Sets the center of the radial gradient. This will be in local coordinates and 1528 // will not depend on the geometry being filled. 1529 // 1530 void SetCenter( D2D1_POINT_2F center ); 1531 1532 1533 // 1534 // Sets offset of the origin relative to the radial gradient center. 1535 // 1536 void SetGradientOriginOffset( D2D1_POINT_2F gradientOriginOffset ); 1537 1538 void SetRadiusX( FLOAT radiusX ); 1539 1540 void SetRadiusY( FLOAT radiusY ); 1541 1542 // BUG: got crash? see ID2D1RenderTarget.GetSize() 1543 ref D2D1_POINT_2F GetCenter() const; 1544 1545 // BUG: got crash? see ID2D1RenderTarget.GetSize() 1546 ref D2D1_POINT_2F GetGradientOriginOffset() const; 1547 1548 FLOAT GetRadiusX() const; 1549 1550 FLOAT GetRadiusY() const; 1551 1552 void GetGradientStopCollection( 1553 /*out*/ ID2D1GradientStopCollection *gradientStopCollection 1554 ) const; 1555 } // interface ID2D1RadialGradientBrush 1556 1557 1558 1559 //+----------------------------------------------------------------------------- 1560 // 1561 // Interface: 1562 // ID2D1StrokeStyle 1563 // 1564 // Synopsis: 1565 // Resource interface that holds pen style properties. 1566 // 1567 //------------------------------------------------------------------------------ 1568 mixin( uuid!(ID2D1StrokeStyle, "2cd9069d-12e2-11dc-9fed-001143a055f9") ); 1569 interface ID2D1StrokeStyle : ID2D1Resource 1570 { 1571 extern(Windows): 1572 1573 D2D1_CAP_STYLE GetStartCap() const; 1574 1575 D2D1_CAP_STYLE GetEndCap() const; 1576 1577 D2D1_CAP_STYLE GetDashCap() const; 1578 1579 FLOAT GetMiterLimit() const; 1580 1581 D2D1_LINE_JOIN GetLineJoin() const; 1582 1583 FLOAT GetDashOffset() const; 1584 1585 D2D1_DASH_STYLE GetDashStyle() const; 1586 1587 UINT32 GetDashesCount() const; 1588 1589 /* 1590 // 1591 // Returns the dashes from the object into a user allocated array. The user must 1592 // call GetDashesCount to retrieve the required size. 1593 // 1594 STDMETHOD_(void, GetDashes)( 1595 _Out_writes_(dashesCount) FLOAT *dashes, 1596 UINT32 dashesCount 1597 ) CONST PURE; 1598 */ 1599 } // interface ID2D1StrokeStyle 1600 1601 1602 1603 //+----------------------------------------------------------------------------- 1604 // 1605 // Interface: 1606 // ID2D1Geometry 1607 // 1608 //------------------------------------------------------------------------------ 1609 mixin( uuid!(ID2D1Geometry, "2cd906a1-12e2-11dc-9fed-001143a055f9") ); 1610 interface ID2D1Geometry : ID2D1Resource 1611 { 1612 extern(Windows): 1613 1614 // 1615 // Retrieve the bounds of the geometry, with an optional applied transform. 1616 // 1617 HRESULT GetBounds( 1618 const(D2D1_MATRIX_3X2_F)* worldTransform, 1619 /*out*/ D2D1_RECT_F* bounds 1620 ) const; 1621 1622 1623 // 1624 // Get the bounds of the corresponding geometry after it has been widened or have 1625 // an optional pen style applied. 1626 // 1627 HRESULT GetWidenedBounds( 1628 FLOAT strokeWidth, 1629 ID2D1StrokeStyle strokeStyle, 1630 const(D2D1_MATRIX_3X2_F)* worldTransform, 1631 FLOAT flatteningTolerance, 1632 /*out*/ D2D1_RECT_F *bounds 1633 ) const; 1634 1635 1636 // 1637 // Checks to see whether the corresponding penned and widened geometry contains the 1638 // given point. 1639 // 1640 HRESULT StrokeContainsPoint( 1641 D2D1_POINT_2F point, 1642 FLOAT strokeWidth, 1643 ID2D1StrokeStyle strokeStyle, 1644 const(D2D1_MATRIX_3X2_F)* worldTransform, 1645 FLOAT flatteningTolerance, 1646 /*out*/BOOL* contains 1647 ) const; 1648 1649 1650 // 1651 // Test whether the given fill of this geometry would contain this point. 1652 // 1653 HRESULT FillContainsPoint( 1654 D2D1_POINT_2F point, 1655 const(D2D1_MATRIX_3X2_F)* worldTransform, 1656 FLOAT flatteningTolerance, 1657 /*out*/ BOOL *contains 1658 ) const; 1659 1660 1661 // 1662 // Compare how one geometry intersects or contains another geometry. 1663 // 1664 HRESULT CompareWithGeometry( 1665 ID2D1Geometry inputGeometry, 1666 const(D2D1_MATRIX_3X2_F)* inputGeometryTransform, 1667 FLOAT flatteningTolerance, 1668 /*out*/ D2D1_GEOMETRY_RELATION *relation 1669 ) const; 1670 1671 1672 // 1673 // Converts a geometry to a simplified geometry that has arcs and quadratic beziers 1674 // removed. 1675 // 1676 HRESULT Simplify( 1677 D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, 1678 const(D2D1_MATRIX_3X2_F)* worldTransform, 1679 FLOAT flatteningTolerance, 1680 ID2D1SimplifiedGeometrySink geometrySink 1681 ) const; 1682 1683 1684 // 1685 // Tessellates a geometry into triangles. 1686 // 1687 HRESULT Tessellate( 1688 const(D2D1_MATRIX_3X2_F)* worldTransform, 1689 FLOAT flatteningTolerance, 1690 ID2D1TessellationSink tessellationSink 1691 ) const; 1692 1693 1694 // 1695 // Performs a combine operation between the two geometries to produce a resulting 1696 // geometry. 1697 // 1698 HRESULT CombineWithGeometry( 1699 ID2D1Geometry inputGeometry, 1700 D2D1_COMBINE_MODE combineMode, 1701 const(D2D1_MATRIX_3X2_F)* inputGeometryTransform, 1702 FLOAT flatteningTolerance, 1703 ID2D1SimplifiedGeometrySink geometrySink 1704 ) const; 1705 1706 1707 // 1708 // Computes the outline of the geometry. The result is written back into a 1709 // simplified geometry sink. 1710 // 1711 HRESULT Outline( 1712 const(D2D1_MATRIX_3X2_F)* worldTransform, 1713 FLOAT flatteningTolerance, 1714 ID2D1SimplifiedGeometrySink geometrySink 1715 ) const; 1716 1717 1718 // 1719 // Computes the area of the geometry. 1720 // 1721 HRESULT ComputeArea( 1722 const(D2D1_MATRIX_3X2_F)* worldTransform, 1723 FLOAT flatteningTolerance, 1724 /*out*/ FLOAT *area 1725 ) const; 1726 1727 1728 // 1729 // Computes the length of the geometry. 1730 // 1731 HRESULT ComputeLength( 1732 const(D2D1_MATRIX_3X2_F)* worldTransform, 1733 FLOAT flatteningTolerance, 1734 /*out*/ FLOAT *length 1735 ) const; 1736 1737 1738 // 1739 // Computes the point and tangent a given distance along the path. 1740 // 1741 HRESULT ComputePointAtLength( 1742 FLOAT length, 1743 const(D2D1_MATRIX_3X2_F)* worldTransform, 1744 FLOAT flatteningTolerance, 1745 /*out*/ D2D1_POINT_2F *point, 1746 /*out*/ D2D1_POINT_2F *unitTangentVector 1747 ) const; 1748 1749 1750 // 1751 // Get the geometry and widen it as well as apply an optional pen style. 1752 // 1753 HRESULT Widen( 1754 FLOAT strokeWidth, 1755 ID2D1StrokeStyle strokeStyle, 1756 const(D2D1_MATRIX_3X2_F)* worldTransform, 1757 FLOAT flatteningTolerance, 1758 ID2D1SimplifiedGeometrySink geometrySink 1759 ) const; 1760 1761 /* 1762 // 1763 // Retrieve the bounds of the geometry, with an optional applied transform. 1764 // 1765 COM_DECLSPEC_NOTHROW 1766 HRESULT 1767 GetBounds( 1768 CONST D2D1_MATRIX_3X2_F &worldTransform, 1769 _Out_ D2D1_RECT_F *bounds 1770 ) CONST 1771 { 1772 return GetBounds(&worldTransform, bounds); 1773 } 1774 1775 1776 // 1777 // Get the bounds of the corresponding geometry after it has been widened or have 1778 // an optional pen style applied. 1779 // 1780 COM_DECLSPEC_NOTHROW 1781 HRESULT 1782 GetWidenedBounds( 1783 FLOAT strokeWidth, 1784 _In_opt_ ID2D1StrokeStyle *strokeStyle, 1785 CONST D2D1_MATRIX_3X2_F &worldTransform, 1786 FLOAT flatteningTolerance, 1787 _Out_ D2D1_RECT_F *bounds 1788 ) CONST 1789 { 1790 return GetWidenedBounds(strokeWidth, strokeStyle, &worldTransform, flatteningTolerance, bounds); 1791 } 1792 1793 1794 // 1795 // Get the bounds of the corresponding geometry after it has been widened or have 1796 // an optional pen style applied. 1797 // 1798 COM_DECLSPEC_NOTHROW 1799 HRESULT 1800 GetWidenedBounds( 1801 FLOAT strokeWidth, 1802 _In_opt_ ID2D1StrokeStyle *strokeStyle, 1803 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform, 1804 _Out_ D2D1_RECT_F *bounds 1805 ) CONST 1806 { 1807 return GetWidenedBounds(strokeWidth, strokeStyle, worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, bounds); 1808 } 1809 1810 1811 // 1812 // Get the bounds of the corresponding geometry after it has been widened or have 1813 // an optional pen style applied. 1814 // 1815 COM_DECLSPEC_NOTHROW 1816 HRESULT 1817 GetWidenedBounds( 1818 FLOAT strokeWidth, 1819 _In_opt_ ID2D1StrokeStyle *strokeStyle, 1820 CONST D2D1_MATRIX_3X2_F &worldTransform, 1821 _Out_ D2D1_RECT_F *bounds 1822 ) CONST 1823 { 1824 return GetWidenedBounds(strokeWidth, strokeStyle, &worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, bounds); 1825 } 1826 1827 COM_DECLSPEC_NOTHROW 1828 HRESULT 1829 StrokeContainsPoint( 1830 D2D1_POINT_2F point, 1831 FLOAT strokeWidth, 1832 _In_opt_ ID2D1StrokeStyle *strokeStyle, 1833 CONST D2D1_MATRIX_3X2_F &worldTransform, 1834 FLOAT flatteningTolerance, 1835 _Out_ BOOL *contains 1836 ) CONST 1837 { 1838 return StrokeContainsPoint(point, strokeWidth, strokeStyle, &worldTransform, flatteningTolerance, contains); 1839 } 1840 1841 1842 // 1843 // Checks to see whether the corresponding penned and widened geometry contains the 1844 // given point. 1845 // 1846 COM_DECLSPEC_NOTHROW 1847 HRESULT 1848 StrokeContainsPoint( 1849 D2D1_POINT_2F point, 1850 FLOAT strokeWidth, 1851 _In_opt_ ID2D1StrokeStyle *strokeStyle, 1852 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform, 1853 _Out_ BOOL *contains 1854 ) CONST 1855 { 1856 return StrokeContainsPoint(point, strokeWidth, strokeStyle, worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, contains); 1857 } 1858 1859 COM_DECLSPEC_NOTHROW 1860 HRESULT 1861 StrokeContainsPoint( 1862 D2D1_POINT_2F point, 1863 FLOAT strokeWidth, 1864 _In_opt_ ID2D1StrokeStyle *strokeStyle, 1865 CONST D2D1_MATRIX_3X2_F &worldTransform, 1866 _Out_ BOOL *contains 1867 ) CONST 1868 { 1869 return StrokeContainsPoint(point, strokeWidth, strokeStyle, &worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, contains); 1870 } 1871 1872 COM_DECLSPEC_NOTHROW 1873 HRESULT 1874 FillContainsPoint( 1875 D2D1_POINT_2F point, 1876 CONST D2D1_MATRIX_3X2_F &worldTransform, 1877 FLOAT flatteningTolerance, 1878 _Out_ BOOL *contains 1879 ) CONST 1880 { 1881 return FillContainsPoint(point, &worldTransform, flatteningTolerance, contains); 1882 } 1883 1884 1885 // 1886 // Test whether the given fill of this geometry would contain this point. 1887 // 1888 COM_DECLSPEC_NOTHROW 1889 HRESULT 1890 FillContainsPoint( 1891 D2D1_POINT_2F point, 1892 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform, 1893 _Out_ BOOL *contains 1894 ) CONST 1895 { 1896 return FillContainsPoint(point, worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, contains); 1897 } 1898 1899 COM_DECLSPEC_NOTHROW 1900 HRESULT 1901 FillContainsPoint( 1902 D2D1_POINT_2F point, 1903 CONST D2D1_MATRIX_3X2_F &worldTransform, 1904 _Out_ BOOL *contains 1905 ) CONST 1906 { 1907 return FillContainsPoint(point, &worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, contains); 1908 } 1909 1910 1911 // 1912 // Compare how one geometry intersects or contains another geometry. 1913 // 1914 COM_DECLSPEC_NOTHROW 1915 HRESULT 1916 CompareWithGeometry( 1917 _In_ ID2D1Geometry *inputGeometry, 1918 CONST D2D1_MATRIX_3X2_F &inputGeometryTransform, 1919 FLOAT flatteningTolerance, 1920 _Out_ D2D1_GEOMETRY_RELATION *relation 1921 ) CONST 1922 { 1923 return CompareWithGeometry(inputGeometry, &inputGeometryTransform, flatteningTolerance, relation); 1924 } 1925 1926 1927 // 1928 // Compare how one geometry intersects or contains another geometry. 1929 // 1930 COM_DECLSPEC_NOTHROW 1931 HRESULT 1932 CompareWithGeometry( 1933 _In_ ID2D1Geometry *inputGeometry, 1934 _In_opt_ CONST D2D1_MATRIX_3X2_F *inputGeometryTransform, 1935 _Out_ D2D1_GEOMETRY_RELATION *relation 1936 ) CONST 1937 { 1938 return CompareWithGeometry(inputGeometry, inputGeometryTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, relation); 1939 } 1940 1941 1942 // 1943 // Compare how one geometry intersects or contains another geometry. 1944 // 1945 COM_DECLSPEC_NOTHROW 1946 HRESULT 1947 CompareWithGeometry( 1948 _In_ ID2D1Geometry *inputGeometry, 1949 CONST D2D1_MATRIX_3X2_F &inputGeometryTransform, 1950 _Out_ D2D1_GEOMETRY_RELATION *relation 1951 ) CONST 1952 { 1953 return CompareWithGeometry(inputGeometry, &inputGeometryTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, relation); 1954 } 1955 1956 1957 // 1958 // Converts a geometry to a simplified geometry that has arcs and quadratic beziers 1959 // removed. 1960 // 1961 COM_DECLSPEC_NOTHROW 1962 HRESULT 1963 Simplify( 1964 D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, 1965 CONST D2D1_MATRIX_3X2_F &worldTransform, 1966 FLOAT flatteningTolerance, 1967 _In_ ID2D1SimplifiedGeometrySink *geometrySink 1968 ) CONST 1969 { 1970 return Simplify(simplificationOption, &worldTransform, flatteningTolerance, geometrySink); 1971 } 1972 1973 1974 // 1975 // Converts a geometry to a simplified geometry that has arcs and quadratic beziers 1976 // removed. 1977 // 1978 COM_DECLSPEC_NOTHROW 1979 HRESULT 1980 Simplify( 1981 D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, 1982 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform, 1983 _In_ ID2D1SimplifiedGeometrySink *geometrySink 1984 ) CONST 1985 { 1986 return Simplify(simplificationOption, worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, geometrySink); 1987 } 1988 1989 1990 // 1991 // Converts a geometry to a simplified geometry that has arcs and quadratic beziers 1992 // removed. 1993 // 1994 COM_DECLSPEC_NOTHROW 1995 HRESULT 1996 Simplify( 1997 D2D1_GEOMETRY_SIMPLIFICATION_OPTION simplificationOption, 1998 CONST D2D1_MATRIX_3X2_F &worldTransform, 1999 _In_ ID2D1SimplifiedGeometrySink *geometrySink 2000 ) CONST 2001 { 2002 return Simplify(simplificationOption, &worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, geometrySink); 2003 } 2004 2005 2006 // 2007 // Tessellates a geometry into triangles. 2008 // 2009 COM_DECLSPEC_NOTHROW 2010 HRESULT 2011 Tessellate( 2012 CONST D2D1_MATRIX_3X2_F &worldTransform, 2013 FLOAT flatteningTolerance, 2014 _In_ ID2D1TessellationSink *tessellationSink 2015 ) CONST 2016 { 2017 return Tessellate(&worldTransform, flatteningTolerance, tessellationSink); 2018 } 2019 2020 2021 // 2022 // Tessellates a geometry into triangles. 2023 // 2024 COM_DECLSPEC_NOTHROW 2025 HRESULT 2026 Tessellate( 2027 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform, 2028 _In_ ID2D1TessellationSink *tessellationSink 2029 ) CONST 2030 { 2031 return Tessellate(worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, tessellationSink); 2032 } 2033 2034 2035 // 2036 // Tessellates a geometry into triangles. 2037 // 2038 COM_DECLSPEC_NOTHROW 2039 HRESULT 2040 Tessellate( 2041 CONST D2D1_MATRIX_3X2_F &worldTransform, 2042 _In_ ID2D1TessellationSink *tessellationSink 2043 ) CONST 2044 { 2045 return Tessellate(&worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, tessellationSink); 2046 } 2047 2048 2049 // 2050 // Performs a combine operation between the two geometries to produce a resulting 2051 // geometry. 2052 // 2053 COM_DECLSPEC_NOTHROW 2054 HRESULT 2055 CombineWithGeometry( 2056 _In_ ID2D1Geometry *inputGeometry, 2057 D2D1_COMBINE_MODE combineMode, 2058 CONST D2D1_MATRIX_3X2_F &inputGeometryTransform, 2059 FLOAT flatteningTolerance, 2060 _In_ ID2D1SimplifiedGeometrySink *geometrySink 2061 ) CONST 2062 { 2063 return CombineWithGeometry(inputGeometry, combineMode, &inputGeometryTransform, flatteningTolerance, geometrySink); 2064 } 2065 2066 2067 // 2068 // Performs a combine operation between the two geometries to produce a resulting 2069 // geometry. 2070 // 2071 COM_DECLSPEC_NOTHROW 2072 HRESULT 2073 CombineWithGeometry( 2074 _In_ ID2D1Geometry *inputGeometry, 2075 D2D1_COMBINE_MODE combineMode, 2076 _In_opt_ CONST D2D1_MATRIX_3X2_F *inputGeometryTransform, 2077 _In_ ID2D1SimplifiedGeometrySink *geometrySink 2078 ) CONST 2079 { 2080 return CombineWithGeometry(inputGeometry, combineMode, inputGeometryTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, geometrySink); 2081 } 2082 2083 2084 // 2085 // Performs a combine operation between the two geometries to produce a resulting 2086 // geometry. 2087 // 2088 COM_DECLSPEC_NOTHROW 2089 HRESULT 2090 CombineWithGeometry( 2091 _In_ ID2D1Geometry *inputGeometry, 2092 D2D1_COMBINE_MODE combineMode, 2093 CONST D2D1_MATRIX_3X2_F &inputGeometryTransform, 2094 _In_ ID2D1SimplifiedGeometrySink *geometrySink 2095 ) CONST 2096 { 2097 return CombineWithGeometry(inputGeometry, combineMode, &inputGeometryTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, geometrySink); 2098 } 2099 2100 2101 // 2102 // Computes the outline of the geometry. The result is written back into a 2103 // simplified geometry sink. 2104 // 2105 COM_DECLSPEC_NOTHROW 2106 HRESULT 2107 Outline( 2108 CONST D2D1_MATRIX_3X2_F &worldTransform, 2109 FLOAT flatteningTolerance, 2110 _In_ ID2D1SimplifiedGeometrySink *geometrySink 2111 ) CONST 2112 { 2113 return Outline(&worldTransform, flatteningTolerance, geometrySink); 2114 } 2115 2116 2117 // 2118 // Computes the outline of the geometry. The result is written back into a 2119 // simplified geometry sink. 2120 // 2121 COM_DECLSPEC_NOTHROW 2122 HRESULT 2123 Outline( 2124 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform, 2125 _In_ ID2D1SimplifiedGeometrySink *geometrySink 2126 ) CONST 2127 { 2128 return Outline(worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, geometrySink); 2129 } 2130 2131 2132 // 2133 // Computes the outline of the geometry. The result is written back into a 2134 // simplified geometry sink. 2135 // 2136 COM_DECLSPEC_NOTHROW 2137 HRESULT 2138 Outline( 2139 CONST D2D1_MATRIX_3X2_F &worldTransform, 2140 _In_ ID2D1SimplifiedGeometrySink *geometrySink 2141 ) CONST 2142 { 2143 return Outline(&worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, geometrySink); 2144 } 2145 2146 2147 // 2148 // Computes the area of the geometry. 2149 // 2150 COM_DECLSPEC_NOTHROW 2151 HRESULT 2152 ComputeArea( 2153 CONST D2D1_MATRIX_3X2_F &worldTransform, 2154 FLOAT flatteningTolerance, 2155 _Out_ FLOAT *area 2156 ) CONST 2157 { 2158 return ComputeArea(&worldTransform, flatteningTolerance, area); 2159 } 2160 2161 2162 // 2163 // Computes the area of the geometry. 2164 // 2165 COM_DECLSPEC_NOTHROW 2166 HRESULT 2167 ComputeArea( 2168 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform, 2169 _Out_ FLOAT *area 2170 ) CONST 2171 { 2172 return ComputeArea(worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, area); 2173 } 2174 2175 2176 // 2177 // Computes the area of the geometry. 2178 // 2179 COM_DECLSPEC_NOTHROW 2180 HRESULT 2181 ComputeArea( 2182 CONST D2D1_MATRIX_3X2_F &worldTransform, 2183 _Out_ FLOAT *area 2184 ) CONST 2185 { 2186 return ComputeArea(&worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, area); 2187 } 2188 2189 2190 // 2191 // Computes the length of the geometry. 2192 // 2193 COM_DECLSPEC_NOTHROW 2194 HRESULT 2195 ComputeLength( 2196 CONST D2D1_MATRIX_3X2_F &worldTransform, 2197 FLOAT flatteningTolerance, 2198 _Out_ FLOAT *length 2199 ) CONST 2200 { 2201 return ComputeLength(&worldTransform, flatteningTolerance, length); 2202 } 2203 2204 2205 // 2206 // Computes the length of the geometry. 2207 // 2208 COM_DECLSPEC_NOTHROW 2209 HRESULT 2210 ComputeLength( 2211 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform, 2212 _Out_ FLOAT *length 2213 ) CONST 2214 { 2215 return ComputeLength(worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, length); 2216 } 2217 2218 2219 // 2220 // Computes the length of the geometry. 2221 // 2222 COM_DECLSPEC_NOTHROW 2223 HRESULT 2224 ComputeLength( 2225 CONST D2D1_MATRIX_3X2_F &worldTransform, 2226 _Out_ FLOAT *length 2227 ) CONST 2228 { 2229 return ComputeLength(&worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, length); 2230 } 2231 2232 2233 // 2234 // Computes the point and tangent a given distance along the path. 2235 // 2236 COM_DECLSPEC_NOTHROW 2237 HRESULT 2238 ComputePointAtLength( 2239 FLOAT length, 2240 CONST D2D1_MATRIX_3X2_F &worldTransform, 2241 FLOAT flatteningTolerance, 2242 _Out_opt_ D2D1_POINT_2F *point, 2243 _Out_opt_ D2D1_POINT_2F *unitTangentVector 2244 ) CONST 2245 { 2246 return ComputePointAtLength(length, &worldTransform, flatteningTolerance, point, unitTangentVector); 2247 } 2248 2249 2250 // 2251 // Computes the point and tangent a given distance along the path. 2252 // 2253 COM_DECLSPEC_NOTHROW 2254 HRESULT 2255 ComputePointAtLength( 2256 FLOAT length, 2257 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform, 2258 _Out_opt_ D2D1_POINT_2F *point, 2259 _Out_opt_ D2D1_POINT_2F *unitTangentVector 2260 ) CONST 2261 { 2262 return ComputePointAtLength(length, worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, point, unitTangentVector); 2263 } 2264 2265 2266 // 2267 // Computes the point and tangent a given distance along the path. 2268 // 2269 COM_DECLSPEC_NOTHROW 2270 HRESULT 2271 ComputePointAtLength( 2272 FLOAT length, 2273 CONST D2D1_MATRIX_3X2_F &worldTransform, 2274 _Out_opt_ D2D1_POINT_2F *point, 2275 _Out_opt_ D2D1_POINT_2F *unitTangentVector 2276 ) CONST 2277 { 2278 return ComputePointAtLength(length, &worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, point, unitTangentVector); 2279 } 2280 2281 2282 // 2283 // Get the geometry and widen it as well as apply an optional pen style. 2284 // 2285 COM_DECLSPEC_NOTHROW 2286 HRESULT 2287 Widen( 2288 FLOAT strokeWidth, 2289 _In_opt_ ID2D1StrokeStyle *strokeStyle, 2290 CONST D2D1_MATRIX_3X2_F &worldTransform, 2291 FLOAT flatteningTolerance, 2292 _In_ ID2D1SimplifiedGeometrySink *geometrySink 2293 ) CONST 2294 { 2295 return Widen(strokeWidth, strokeStyle, &worldTransform, flatteningTolerance, geometrySink); 2296 } 2297 2298 2299 // 2300 // Get the geometry and widen it as well as apply an optional pen style. 2301 // 2302 COM_DECLSPEC_NOTHROW 2303 HRESULT 2304 Widen( 2305 FLOAT strokeWidth, 2306 _In_opt_ ID2D1StrokeStyle *strokeStyle, 2307 _In_opt_ CONST D2D1_MATRIX_3X2_F *worldTransform, 2308 _In_ ID2D1SimplifiedGeometrySink *geometrySink 2309 ) CONST 2310 { 2311 return Widen(strokeWidth, strokeStyle, worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, geometrySink); 2312 } 2313 2314 2315 // 2316 // Get the geometry and widen it as well as apply an optional pen style. 2317 // 2318 COM_DECLSPEC_NOTHROW 2319 HRESULT 2320 Widen( 2321 FLOAT strokeWidth, 2322 _In_opt_ ID2D1StrokeStyle *strokeStyle, 2323 CONST D2D1_MATRIX_3X2_F &worldTransform, 2324 _In_ ID2D1SimplifiedGeometrySink *geometrySink 2325 ) CONST 2326 { 2327 return Widen(strokeWidth, strokeStyle, &worldTransform, D2D1_DEFAULT_FLATTENING_TOLERANCE, geometrySink); 2328 } 2329 */ 2330 } // interface ID2D1Geometry 2331 2332 2333 2334 //+----------------------------------------------------------------------------- 2335 // 2336 // Interface: 2337 // ID2D1RectangleGeometry 2338 // 2339 //------------------------------------------------------------------------------ 2340 mixin( uuid!(ID2D1RectangleGeometry, "2cd906a2-12e2-11dc-9fed-001143a055f9") ); 2341 interface ID2D1RectangleGeometry : ID2D1Geometry 2342 { 2343 extern(Windows): 2344 void GetRect( 2345 /*out*/ D2D1_RECT_F *rect 2346 ) const; 2347 } // interface ID2D1RectangleGeometry 2348 2349 2350 2351 //+----------------------------------------------------------------------------- 2352 // 2353 // Interface: 2354 // ID2D1RoundedRectangleGeometry 2355 // 2356 //------------------------------------------------------------------------------ 2357 mixin( uuid!(ID2D1RoundedRectangleGeometry, "2cd906a3-12e2-11dc-9fed-001143a055f9") ); 2358 interface ID2D1RoundedRectangleGeometry : ID2D1Geometry 2359 { 2360 extern(Windows): 2361 void GetRoundedRect( 2362 /*out*/ D2D1_ROUNDED_RECT *roundedRect 2363 ) const; 2364 } // interface ID2D1RoundedRectangleGeometry 2365 2366 2367 2368 //+----------------------------------------------------------------------------- 2369 // 2370 // Interface: 2371 // ID2D1EllipseGeometry 2372 // 2373 //------------------------------------------------------------------------------ 2374 mixin( uuid!(ID2D1EllipseGeometry, "2cd906a4-12e2-11dc-9fed-001143a055f9") ); 2375 interface ID2D1EllipseGeometry : ID2D1Geometry 2376 { 2377 extern(Windows): 2378 void GetEllipse( 2379 /*out*/ D2D1_ELLIPSE *ellipse 2380 ) const; 2381 } // interface ID2D1EllipseGeometry 2382 2383 2384 2385 //+----------------------------------------------------------------------------- 2386 // 2387 // Interface: 2388 // ID2D1GeometryGroup 2389 // 2390 //------------------------------------------------------------------------------ 2391 mixin( uuid!(ID2D1GeometryGroup, "2cd906a6-12e2-11dc-9fed-001143a055f9") ); 2392 interface ID2D1GeometryGroup : ID2D1Geometry 2393 { 2394 extern(Windows): 2395 D2D1_FILL_MODE GetFillMode() const; 2396 2397 UINT32 GetSourceGeometryCount() const; 2398 2399 void GetSourceGeometries( 2400 ID2D1Geometry* geometries, 2401 UINT32 geometriesCount 2402 ) const; 2403 } // interface ID2D1GeometryGroup 2404 2405 2406 2407 //+----------------------------------------------------------------------------- 2408 // 2409 // Interface: 2410 // ID2D1TransformedGeometry 2411 // 2412 //------------------------------------------------------------------------------ 2413 mixin( uuid!(ID2D1TransformedGeometry, "2cd906bb-12e2-11dc-9fed-001143a055f9") ); 2414 interface ID2D1TransformedGeometry : ID2D1Geometry 2415 { 2416 extern(Windows): 2417 void GetSourceGeometry( 2418 /*out*/ ID2D1Geometry* sourceGeometry 2419 ) const; 2420 2421 void GetTransform( 2422 /*out*/ D2D1_MATRIX_3X2_F *transform 2423 ) const; 2424 } // interface ID2D1TransformedGeometry 2425 2426 2427 2428 //+----------------------------------------------------------------------------- 2429 // 2430 // Interface: 2431 // ID2D1SimplifiedGeometrySink 2432 // 2433 //------------------------------------------------------------------------------ 2434 mixin( uuid!(ID2D1SimplifiedGeometrySink, "2cd9069e-12e2-11dc-9fed-001143a055f9") ); 2435 interface ID2D1SimplifiedGeometrySink : IUnknown 2436 { 2437 extern(Windows): 2438 void SetFillMode( 2439 D2D1_FILL_MODE fillMode 2440 ); 2441 2442 void SetSegmentFlags( 2443 D2D1_PATH_SEGMENT vertexFlags 2444 ); 2445 2446 void BeginFigure( 2447 D2D1_POINT_2F startPoint, 2448 D2D1_FIGURE_BEGIN figureBegin 2449 ); 2450 2451 void AddLines( 2452 const(D2D1_POINT_2F)* points, 2453 UINT32 pointsCount 2454 ); 2455 2456 void AddBeziers( 2457 const(D2D1_BEZIER_SEGMENT)* beziers, 2458 UINT32 beziersCount 2459 ); 2460 2461 void EndFigure( 2462 D2D1_FIGURE_END figureEnd 2463 ); 2464 2465 HRESULT Close(); 2466 } // interface ID2D1SimplifiedGeometrySink 2467 2468 2469 2470 //+----------------------------------------------------------------------------- 2471 // 2472 // Interface: 2473 // ID2D1GeometrySink 2474 // 2475 //------------------------------------------------------------------------------ 2476 mixin( uuid!(ID2D1GeometrySink, "2cd9069f-12e2-11dc-9fed-001143a055f9") ); 2477 interface ID2D1GeometrySink : ID2D1SimplifiedGeometrySink 2478 { 2479 extern(Windows): 2480 void AddLine( 2481 D2D1_POINT_2F point 2482 ); 2483 2484 void AddBezier( 2485 const(D2D1_BEZIER_SEGMENT)* bezier 2486 ); 2487 2488 void AddQuadraticBezier( 2489 const(D2D1_QUADRATIC_BEZIER_SEGMENT)* bezier 2490 ); 2491 2492 void AddQuadraticBeziers( 2493 const(D2D1_QUADRATIC_BEZIER_SEGMENT)* beziers, 2494 UINT32 beziersCount 2495 ); 2496 2497 void AddArc( 2498 const(D2D1_ARC_SEGMENT)* arc 2499 ); 2500 /* 2501 COM_DECLSPEC_NOTHROW 2502 void 2503 AddBezier( 2504 CONST D2D1_BEZIER_SEGMENT &bezier 2505 ) 2506 { 2507 AddBezier(&bezier); 2508 } 2509 2510 COM_DECLSPEC_NOTHROW 2511 void 2512 AddQuadraticBezier( 2513 CONST D2D1_QUADRATIC_BEZIER_SEGMENT &bezier 2514 ) 2515 { 2516 AddQuadraticBezier(&bezier); 2517 } 2518 2519 COM_DECLSPEC_NOTHROW 2520 void 2521 AddArc( 2522 CONST D2D1_ARC_SEGMENT &arc 2523 ) 2524 { 2525 AddArc(&arc); 2526 } 2527 */ 2528 } // interface ID2D1GeometrySink 2529 2530 2531 2532 //+----------------------------------------------------------------------------- 2533 // 2534 // Interface: 2535 // ID2D1TessellationSink 2536 // 2537 //------------------------------------------------------------------------------ 2538 mixin( uuid!(ID2D1TessellationSink, "2cd906c1-12e2-11dc-9fed-001143a055f9") ); 2539 interface ID2D1TessellationSink : IUnknown 2540 { 2541 extern(Windows): 2542 void AddTriangles( 2543 const(D2D1_TRIANGLE)* triangles, 2544 UINT32 trianglesCount 2545 ); 2546 2547 HRESULT Close(); 2548 } // interface ID2D1TessellationSink 2549 2550 2551 2552 //+----------------------------------------------------------------------------- 2553 // 2554 // Interface: 2555 // ID2D1PathGeometry 2556 // 2557 //------------------------------------------------------------------------------ 2558 mixin( uuid!(ID2D1PathGeometry, "2cd906a5-12e2-11dc-9fed-001143a055f9") ); 2559 interface ID2D1PathGeometry : ID2D1Geometry 2560 { 2561 extern(Windows): 2562 2563 // 2564 // Opens a geometry sink that will be used to create this path geometry. 2565 // 2566 HRESULT Open( 2567 /*out*/ ID2D1GeometrySink* geometrySink 2568 ); 2569 2570 2571 // 2572 // Retrieve the contents of this geometry. The caller passes an implementation of a 2573 // ID2D1GeometrySink interface to receive the data. 2574 // 2575 HRESULT Stream( 2576 ID2D1GeometrySink geometrySink 2577 ); 2578 2579 HRESULT GetSegmentCount( 2580 /*out*/ UINT32 *count 2581 ); 2582 2583 HRESULT GetFigureCount( 2584 /*out*/ UINT32 *count 2585 ); 2586 } // interface ID2D1PathGeometry 2587 2588 2589 2590 //+----------------------------------------------------------------------------- 2591 // 2592 // Interface: 2593 // ID2D1Mesh 2594 // 2595 //------------------------------------------------------------------------------ 2596 mixin( uuid!(ID2D1Mesh, "2cd906c2-12e2-11dc-9fed-001143a055f9") ); 2597 interface ID2D1Mesh : ID2D1Resource 2598 { 2599 extern(Windows): 2600 2601 // 2602 // Opens the mesh for population. 2603 // 2604 HRESULT Open( 2605 /*out*/ ID2D1TessellationSink* tessellationSink 2606 ); 2607 } // interface ID2D1Mesh 2608 2609 2610 2611 //+----------------------------------------------------------------------------- 2612 // 2613 // Interface: 2614 // ID2D1Layer 2615 // 2616 //------------------------------------------------------------------------------ 2617 mixin( uuid!(ID2D1Layer, "2cd9069b-12e2-11dc-9fed-001143a055f9") ); 2618 interface ID2D1Layer : ID2D1Resource 2619 { 2620 extern(Windows): 2621 2622 // BUG: got crash? see ID2D1RenderTarget.GetSize() 2623 ref D2D1_SIZE_F GetSize() const; 2624 2625 } // interface ID2D1Layer 2626 2627 2628 2629 //+----------------------------------------------------------------------------- 2630 // 2631 // Interface: 2632 // ID2D1DrawingStateBlock 2633 // 2634 //------------------------------------------------------------------------------ 2635 mixin( uuid!(ID2D1DrawingStateBlock, "28506e39-ebf6-46a1-bb47-fd85565ab957") ); 2636 interface ID2D1DrawingStateBlock : ID2D1Resource 2637 { 2638 extern(Windows): 2639 2640 // 2641 // Retrieves the state currently contained within this state block resource. 2642 // 2643 void GetDescription( 2644 /*out*/ D2D1_DRAWING_STATE_DESCRIPTION *stateDescription 2645 ) const; 2646 2647 2648 // 2649 // Sets the state description of this state block resource. 2650 // 2651 void SetDescription( 2652 const(D2D1_DRAWING_STATE_DESCRIPTION)* stateDescription 2653 ); 2654 2655 2656 // 2657 // Sets the text rendering parameters of this state block resource. 2658 // 2659 void SetTextRenderingParams( 2660 IDWriteRenderingParams textRenderingParams = null 2661 ); 2662 2663 2664 // 2665 // Retrieves the text rendering parameters contained within this state block 2666 // resource. If a NULL text rendering parameter was specified, NULL will be 2667 // returned. 2668 // 2669 void GetTextRenderingParams( 2670 /*out*/ IDWriteRenderingParams* textRenderingParams 2671 ) const; 2672 2673 /* 2674 COM_DECLSPEC_NOTHROW 2675 void 2676 SetDescription( 2677 CONST D2D1_DRAWING_STATE_DESCRIPTION &stateDescription 2678 ) 2679 { 2680 SetDescription(&stateDescription); 2681 } 2682 */ 2683 } // interface ID2D1DrawingStateBlock 2684 2685 2686 2687 //+----------------------------------------------------------------------------- 2688 // 2689 // Interface: 2690 // ID2D1RenderTarget 2691 // 2692 //------------------------------------------------------------------------------ 2693 mixin( uuid!(ID2D1RenderTarget, "2cd90694-12e2-11dc-9fed-001143a055f9") ); 2694 interface ID2D1RenderTarget : ID2D1Resource 2695 { 2696 extern(Windows): 2697 2698 // 2699 // Create a D2D bitmap by copying from memory, or create uninitialized. 2700 // 2701 HRESULT CreateBitmap( 2702 D2D1_SIZE_U size, 2703 const(void*) srcData, 2704 UINT32 pitch, 2705 const(D2D1_BITMAP_PROPERTIES)* bitmapProperties, 2706 /*out*/ID2D1Bitmap* bitmap 2707 ); 2708 2709 2710 // 2711 // Create a D2D bitmap by copying a WIC bitmap. 2712 // 2713 version(WinCodec) 2714 HRESULT CreateBitmapFromWicBitmap( 2715 IWICBitmapSource wicBitmapSource, 2716 const(D2D1_BITMAP_PROPERTIES)* bitmapProperties, 2717 /*out*/ ID2D1Bitmap *bitmap 2718 ); 2719 2720 2721 // 2722 // Create a D2D bitmap by sharing bits from another resource. The bitmap must be 2723 // compatible with the render target for the call to succeed. 2724 // For example, an IWICBitmap can be shared with a software target, or a DXGI 2725 // surface can be shared with a DXGI render target. 2726 // 2727 HRESULT CreateSharedBitmap( 2728 REFIID riid, 2729 void *data, 2730 const(D2D1_BITMAP_PROPERTIES)* bitmapProperties, 2731 /*out*/ ID2D1Bitmap* bitmap 2732 ); 2733 2734 2735 // 2736 // Creates a bitmap brush. The bitmap is scaled, rotated, skewed or tiled to fill 2737 // or pen a geometry. 2738 // 2739 HRESULT CreateBitmapBrush( 2740 ID2D1Bitmap bitmap, 2741 const(D2D1_BITMAP_BRUSH_PROPERTIES)* bitmapBrushProperties, 2742 const(D2D1_BRUSH_PROPERTIES)* brushProperties, 2743 /*out*/ ID2D1BitmapBrush* bitmapBrush 2744 ); 2745 2746 HRESULT CreateSolidColorBrush( 2747 const(D2D1_COLOR_F)* color, 2748 const(D2D1_BRUSH_PROPERTIES)* brushProperties, 2749 /*out*/ ID2D1SolidColorBrush* solidColorBrush 2750 ); 2751 2752 2753 // 2754 // A gradient stop collection represents a set of stops in an ideal unit length. 2755 // This is the source resource for a linear gradient and radial gradient brush. 2756 // 2757 HRESULT CreateGradientStopCollection( 2758 const(D2D1_GRADIENT_STOP)* gradientStops, 2759 UINT32 gradientStopsCount, 2760 2761 // 2762 // Specifies which space the color interpolation occurs in. 2763 // 2764 D2D1_GAMMA colorInterpolationGamma, 2765 2766 // 2767 // Specifies how the gradient will be extended outside of the unit length. 2768 // 2769 D2D1_EXTEND_MODE extendMode, 2770 /*out*/ ID2D1GradientStopCollection* gradientStopCollection 2771 ); 2772 2773 HRESULT CreateLinearGradientBrush( 2774 const(D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES)* linearGradientBrushProperties, 2775 const(D2D1_BRUSH_PROPERTIES)* brushProperties, 2776 ID2D1GradientStopCollection gradientStopCollection, 2777 /*out*/ ID2D1LinearGradientBrush* linearGradientBrush 2778 ); 2779 2780 HRESULT CreateRadialGradientBrush( 2781 const(D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES)* radialGradientBrushProperties, 2782 const(D2D1_BRUSH_PROPERTIES)* brushProperties, 2783 ID2D1GradientStopCollection gradientStopCollection, 2784 /*out*/ ID2D1RadialGradientBrush* radialGradientBrush 2785 ); 2786 2787 2788 // 2789 // Creates a bitmap render target whose bitmap can be used as a source for 2790 // rendering in the API. 2791 // 2792 HRESULT CreateCompatibleRenderTarget( 2793 2794 // 2795 // The requested size of the target in DIPs. If the pixel size is not specified, 2796 // the DPI is inherited from the parent target. However, the render target will 2797 // never contain a fractional number of pixels. 2798 // 2799 const(D2D1_SIZE_F)* desiredSize, 2800 2801 // 2802 // The requested size of the render target in pixels. If the DIP size is also 2803 // specified, the DPI is calculated from these two values. If the desired size is 2804 // not specified, the DPI is inherited from the parent render target. If neither 2805 // value is specified, the compatible render target will be the same size and have 2806 // the same DPI as the parent target. 2807 // 2808 const(D2D1_SIZE_U)* desiredPixelSize, 2809 2810 // 2811 // The desired pixel format. The format must be compatible with the parent render 2812 // target type. If the format is not specified, it will be inherited from the 2813 // parent render target. 2814 // 2815 const(D2D1_PIXEL_FORMAT)* desiredFormat, 2816 2817 // 2818 // Allows the caller to retrieve a GDI compatible render target. 2819 // 2820 D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options, 2821 2822 // 2823 // The returned bitmap render target. 2824 // 2825 /*out*/ ID2D1BitmapRenderTarget* bitmapRenderTarget 2826 ); 2827 2828 2829 // 2830 // Creates a layer resource that can be used on any target and which will resize 2831 // under the covers if necessary. 2832 // 2833 HRESULT CreateLayer( 2834 2835 // 2836 // The resolution independent minimum size hint for the layer resource. Specify 2837 // this to prevent unwanted reallocation of the layer backing store. The size is in 2838 // DIPs, but, it is unaffected by the current world transform. If the size is 2839 // unspecified, the returned resource is a placeholder and the backing store will 2840 // be allocated to be the minimum size that can hold the content when the layer is 2841 // pushed. 2842 // 2843 const(D2D1_SIZE_F)* size, 2844 /*out*/ ID2D1Layer* layer 2845 ); 2846 2847 2848 // 2849 // Create a D2D mesh. 2850 // 2851 HRESULT CreateMesh( 2852 /*out*/ ID2D1Mesh* mesh 2853 ); 2854 2855 void DrawLine( 2856 D2D1_POINT_2F point0, 2857 D2D1_POINT_2F point1, 2858 ID2D1Brush brush, 2859 FLOAT strokeWidth = 1.0f, 2860 ID2D1StrokeStyle strokeStyle = null 2861 ); 2862 2863 void DrawRectangle( 2864 const(D2D1_RECT_F)* rect, 2865 ID2D1Brush brush, 2866 FLOAT strokeWidth = 1.0f, 2867 ID2D1StrokeStyle strokeStyle = null 2868 ); 2869 2870 void FillRectangle( 2871 const(D2D1_RECT_F)* rect, 2872 ID2D1Brush brush 2873 ); 2874 2875 void DrawRoundedRectangle( 2876 const(D2D1_ROUNDED_RECT)* roundedRect, 2877 ID2D1Brush brush, 2878 FLOAT strokeWidth = 1.0f, 2879 ID2D1StrokeStyle strokeStyle = null 2880 ); 2881 2882 void FillRoundedRectangle( 2883 const(D2D1_ROUNDED_RECT)* roundedRect, 2884 ID2D1Brush brush 2885 ); 2886 2887 void DrawEllipse( 2888 const(D2D1_ELLIPSE)* ellipse, 2889 ID2D1Brush brush, 2890 FLOAT strokeWidth = 1.0f, 2891 ID2D1StrokeStyle strokeStyle = null 2892 ); 2893 2894 void FillEllipse( 2895 const(D2D1_ELLIPSE)* ellipse, 2896 ID2D1Brush brush 2897 ); 2898 2899 void DrawGeometry( 2900 ID2D1Geometry geometry, 2901 ID2D1Brush brush, 2902 FLOAT strokeWidth = 1.0f, 2903 ID2D1StrokeStyle strokeStyle = null 2904 ); 2905 2906 void FillGeometry( 2907 ID2D1Geometry geometry, 2908 ID2D1Brush brush, 2909 2910 // 2911 // An optionally specified opacity brush. Only the alpha channel of the 2912 // corresponding brush will be sampled and will be applied to the entire fill of 2913 // the geometry. If this brush is specified, the fill brush must be a bitmap brush 2914 // with an extend mode of D2D1_EXTEND_MODE_CLAMP. 2915 // 2916 ID2D1Brush opacityBrush = null 2917 ); 2918 2919 2920 // 2921 // Fill a mesh. Since meshes can only render aliased content, the render target 2922 // antialiasing mode must be set to aliased. 2923 // 2924 void FillMesh( 2925 ID2D1Mesh mesh, 2926 ID2D1Brush brush 2927 ); 2928 2929 2930 // 2931 // Fill using the alpha channel of the supplied opacity mask bitmap. The brush 2932 // opacity will be modulated by the mask. The render target antialiasing mode must 2933 // be set to aliased. 2934 // 2935 void FillOpacityMask( 2936 ID2D1Bitmap opacityMask, 2937 ID2D1Brush brush, 2938 D2D1_OPACITY_MASK_CONTENT content, 2939 const(D2D1_RECT_F)* destinationRectangle = null, 2940 const(D2D1_RECT_F)* sourceRectangle = null 2941 ); 2942 2943 void DrawBitmap( 2944 ID2D1Bitmap bitmap, 2945 const(D2D1_RECT_F)* destinationRectangle = null, 2946 FLOAT opacity = 1.0f, 2947 D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, 2948 const(D2D1_RECT_F)* sourceRectangle = null 2949 ); 2950 2951 2952 // 2953 // Draws the text within the given layout rectangle and by default also snaps and 2954 // clips it to the content bounds. 2955 // 2956 void DrawText( 2957 const(WCHAR)* string, 2958 UINT32 stringLength, 2959 IDWriteTextFormat textFormat, 2960 const(D2D1_RECT_F)* layoutRect, 2961 ID2D1Brush defaultForegroundBrush, 2962 D2D1_DRAW_TEXT_OPTIONS options = D2D1_DRAW_TEXT_OPTIONS_NONE, 2963 DWRITE_MEASURING_MODE measuringMode = DWRITE_MEASURING_MODE_NATURAL 2964 ); 2965 2966 2967 // 2968 // Draw a snapped text layout object. Since the layout is not subsequently changed, 2969 // this can be more efficient than DrawText when drawing the same layout 2970 // repeatedly. 2971 // 2972 void DrawTextLayout( 2973 D2D1_POINT_2F origin, 2974 IDWriteTextLayout textLayout, 2975 ID2D1Brush defaultForegroundBrush, 2976 2977 // 2978 // The specified text options. NOTE: By default the text is clipped to the layout 2979 // bounds. This is derived from the origin and the layout bounds of the 2980 // corresponding IDWriteTextLayout object. 2981 // 2982 D2D1_DRAW_TEXT_OPTIONS options = D2D1_DRAW_TEXT_OPTIONS_NONE 2983 ); 2984 2985 void DrawGlyphRun( 2986 D2D1_POINT_2F baselineOrigin, 2987 const(DWRITE_GLYPH_RUN)* glyphRun, 2988 ID2D1Brush foregroundBrush, 2989 DWRITE_MEASURING_MODE measuringMode = DWRITE_MEASURING_MODE_NATURAL 2990 ); 2991 2992 void SetTransform( 2993 const(D2D1_MATRIX_3X2_F)* transform 2994 ); 2995 2996 void GetTransform( 2997 /*out*/ D2D1_MATRIX_3X2_F* transform 2998 ) const; 2999 3000 void SetAntialiasMode( 3001 D2D1_ANTIALIAS_MODE antialiasMode 3002 ); 3003 3004 D2D1_ANTIALIAS_MODE GetAntialiasMode() const; 3005 3006 void SetTextAntialiasMode( 3007 D2D1_TEXT_ANTIALIAS_MODE textAntialiasMode 3008 ); 3009 3010 D2D1_TEXT_ANTIALIAS_MODE GetTextAntialiasMode() const; 3011 3012 void SetTextRenderingParams( 3013 IDWriteRenderingParams textRenderingParams = null 3014 ); 3015 3016 3017 // 3018 // Retrieve the text render parameters. NOTE: If NULL is specified to 3019 // SetTextRenderingParameters, NULL will be returned. 3020 // 3021 void GetTextRenderingParams( 3022 /*out*/ IDWriteRenderingParams* textRenderingParams 3023 ) const; 3024 3025 3026 // 3027 // Set a tag to correspond to the succeeding primitives. If an error occurs 3028 // rendering a primitive, the tags can be returned from the Flush or EndDraw call. 3029 // 3030 void SetTags( 3031 D2D1_TAG tag1, 3032 D2D1_TAG tag2 3033 ); 3034 3035 3036 // 3037 // Retrieves the currently set tags. This does not retrieve the tags corresponding 3038 // to any primitive that is in error. 3039 // 3040 void GetTags( 3041 /*out*/ D2D1_TAG *tag1 = null, 3042 /*out*/ D2D1_TAG *tag2 = null 3043 ) const; 3044 3045 3046 // 3047 // Start a layer of drawing calls. The way in which the layer must be resolved is 3048 // specified first as well as the logical resource that stores the layer 3049 // parameters. The supplied layer resource might grow if the specified content 3050 // cannot fit inside it. The layer will grow monotonically on each axis. If a NULL 3051 // ID2D1Layer is provided, then a layer resource will be allocated automatically. 3052 // 3053 void PushLayer( 3054 const(D2D1_LAYER_PARAMETERS)* layerParameters, 3055 ID2D1Layer layer 3056 ); 3057 3058 3059 // 3060 // Ends a layer that was defined with particular layer resources. 3061 // 3062 void PopLayer(); 3063 3064 HRESULT Flush( 3065 /*out*/ D2D1_TAG *tag1 = null, 3066 /*out*/ D2D1_TAG *tag2 = null 3067 ); 3068 3069 3070 // 3071 // Gets the current drawing state and saves it into the supplied 3072 // IDrawingStatckBlock. 3073 // 3074 void SaveDrawingState( 3075 /*inout*/ ref ID2D1DrawingStateBlock drawingStateBlock 3076 ) const; 3077 3078 3079 // 3080 // Copies the state stored in the block interface. 3081 // 3082 void RestoreDrawingState( 3083 ID2D1DrawingStateBlock drawingStateBlock 3084 ); 3085 3086 3087 // 3088 // Pushes a clip. The clip can be antialiased. The clip must be axis aligned. If 3089 // the current world transform is not axis preserving, then the bounding box of the 3090 // transformed clip rect will be used. The clip will remain in effect until a 3091 // PopAxisAligned clip call is made. 3092 // 3093 void PushAxisAlignedClip( 3094 const(D2D1_RECT_F)* clipRect, 3095 D2D1_ANTIALIAS_MODE antialiasMode 3096 ); 3097 3098 void PopAxisAlignedClip(); 3099 3100 void Clear( 3101 const(D2D1_COLOR_F)* clearColor = null 3102 ); 3103 3104 3105 // 3106 // Start drawing on this render target. Draw calls can only be issued between a 3107 // BeginDraw and EndDraw call. 3108 // 3109 void BeginDraw(); 3110 3111 3112 // 3113 // Ends drawing on the render target, error results can be retrieved at this time, 3114 // or when calling flush. 3115 // 3116 HRESULT EndDraw( 3117 /*out*/ D2D1_TAG *tag1 = null, 3118 /*out*/ D2D1_TAG *tag2 = null 3119 ); 3120 3121 version(CORRECT_ABI) 3122 D2D1_PIXEL_FORMAT GetPixelFormat() const; 3123 else 3124 void GetPixelFormat(D2D1_PIXEL_FORMAT* outPixelFormat) const; // <-- NOTE: ABI bug workaround, see D2D1_PIXEL_FORMAT GetPixelFormat() below 3125 3126 3127 // 3128 // Sets the DPI on the render target. This results in the render target being 3129 // interpreted to a different scale. Neither DPI can be negative. If zero is 3130 // specified for both, the system DPI is chosen. If one is zero and the other 3131 // unspecified, the DPI is not changed. 3132 // 3133 void SetDpi( 3134 FLOAT dpiX, 3135 FLOAT dpiY 3136 ); 3137 3138 3139 // 3140 // Return the current DPI from the target. 3141 // 3142 void GetDpi( 3143 /*out*/ FLOAT *dpiX, 3144 /*out*/ FLOAT *dpiY 3145 ) const; 3146 3147 3148 // 3149 // Returns the size of the render target in DIPs. 3150 // 3151 version(CORRECT_ABI) 3152 D2D1_SIZE_F GetSize() const; 3153 else 3154 void GetSize(D2D1_SIZE_F* outSize) const; // <-- NOTE: ABI bug workaround, see D2D1_SIZE_F GetSize() below 3155 3156 3157 // 3158 // Returns the size of the render target in pixels. 3159 // 3160 version(CORRECT_ABI) 3161 D2D1_SIZE_U GetPixelSize() const; 3162 else 3163 void GetPixelSize(D2D1_SIZE_U* outSize) const; // <-- NOTE: ABI bug workaround, see D2D1_SIZE_U GetPixelSize() below 3164 3165 3166 // 3167 // Returns the maximum bitmap and render target size that is guaranteed to be 3168 // supported by the render target. 3169 // 3170 UINT32 GetMaximumBitmapSize() const; 3171 3172 3173 // 3174 // Returns true if the given properties are supported by this render target. The 3175 // DPI is ignored. NOTE: If the render target type is software, then neither 3176 // D2D1_FEATURE_LEVEL_9 nor D2D1_FEATURE_LEVEL_10 will be considered to be 3177 // supported. 3178 // 3179 BOOL IsSupported( 3180 const(D2D1_RENDER_TARGET_PROPERTIES)* renderTargetProperties 3181 ) const; 3182 3183 /* 3184 COM_DECLSPEC_NOTHROW 3185 HRESULT 3186 CreateBitmap( 3187 D2D1_SIZE_U size, 3188 _In_opt_ CONST void *srcData, 3189 UINT32 pitch, 3190 CONST D2D1_BITMAP_PROPERTIES &bitmapProperties, 3191 _Outptr_ ID2D1Bitmap **bitmap 3192 ) 3193 { 3194 return CreateBitmap(size, srcData, pitch, &bitmapProperties, bitmap); 3195 } 3196 3197 COM_DECLSPEC_NOTHROW 3198 HRESULT 3199 CreateBitmap( 3200 D2D1_SIZE_U size, 3201 CONST D2D1_BITMAP_PROPERTIES &bitmapProperties, 3202 _Outptr_ ID2D1Bitmap **bitmap 3203 ) 3204 { 3205 return CreateBitmap(size, NULL, 0, &bitmapProperties, bitmap); 3206 } 3207 3208 3209 // 3210 // Create a D2D bitmap by copying a WIC bitmap. 3211 // 3212 COM_DECLSPEC_NOTHROW 3213 HRESULT 3214 CreateBitmapFromWicBitmap( 3215 _In_ IWICBitmapSource *wicBitmapSource, 3216 CONST D2D1_BITMAP_PROPERTIES &bitmapProperties, 3217 _Outptr_ ID2D1Bitmap **bitmap 3218 ) 3219 { 3220 return CreateBitmapFromWicBitmap(wicBitmapSource, &bitmapProperties, bitmap); 3221 } 3222 3223 3224 // 3225 // Create a D2D bitmap by copying a WIC bitmap. 3226 // 3227 COM_DECLSPEC_NOTHROW 3228 HRESULT 3229 CreateBitmapFromWicBitmap( 3230 _In_ IWICBitmapSource *wicBitmapSource, 3231 _Outptr_ ID2D1Bitmap **bitmap 3232 ) 3233 { 3234 return CreateBitmapFromWicBitmap(wicBitmapSource, NULL, bitmap); 3235 } 3236 3237 3238 // 3239 // Creates a bitmap brush. The bitmap is scaled, rotated, skewed or tiled to fill 3240 // or pen a geometry. 3241 // 3242 COM_DECLSPEC_NOTHROW 3243 HRESULT 3244 CreateBitmapBrush( 3245 _In_opt_ ID2D1Bitmap *bitmap, 3246 _Outptr_ ID2D1BitmapBrush **bitmapBrush 3247 ) 3248 { 3249 return CreateBitmapBrush(bitmap, NULL, NULL, bitmapBrush); 3250 } 3251 3252 3253 // 3254 // Creates a bitmap brush. The bitmap is scaled, rotated, skewed or tiled to fill 3255 // or pen a geometry. 3256 // 3257 COM_DECLSPEC_NOTHROW 3258 HRESULT 3259 CreateBitmapBrush( 3260 _In_opt_ ID2D1Bitmap *bitmap, 3261 CONST D2D1_BITMAP_BRUSH_PROPERTIES &bitmapBrushProperties, 3262 _Outptr_ ID2D1BitmapBrush **bitmapBrush 3263 ) 3264 { 3265 return CreateBitmapBrush(bitmap, &bitmapBrushProperties, NULL, bitmapBrush); 3266 } 3267 3268 3269 // 3270 // Creates a bitmap brush. The bitmap is scaled, rotated, skewed or tiled to fill 3271 // or pen a geometry. 3272 // 3273 COM_DECLSPEC_NOTHROW 3274 HRESULT 3275 CreateBitmapBrush( 3276 _In_opt_ ID2D1Bitmap *bitmap, 3277 CONST D2D1_BITMAP_BRUSH_PROPERTIES &bitmapBrushProperties, 3278 CONST D2D1_BRUSH_PROPERTIES &brushProperties, 3279 _Outptr_ ID2D1BitmapBrush **bitmapBrush 3280 ) 3281 { 3282 return CreateBitmapBrush(bitmap, &bitmapBrushProperties, &brushProperties, bitmapBrush); 3283 } 3284 3285 3286 HRESULT 3287 CreateSolidColorBrush( 3288 const(D2D1_COLOR_F) color, 3289 /+out+/ ID2D1SolidColorBrush* solidColorBrush 3290 ) 3291 { 3292 return CreateSolidColorBrush(&color, null, solidColorBrush); 3293 } 3294 3295 3296 COM_DECLSPEC_NOTHROW 3297 HRESULT 3298 CreateSolidColorBrush( 3299 CONST D2D1_COLOR_F &color, 3300 CONST D2D1_BRUSH_PROPERTIES &brushProperties, 3301 _Outptr_ ID2D1SolidColorBrush **solidColorBrush 3302 ) 3303 { 3304 return CreateSolidColorBrush(&color, &brushProperties, solidColorBrush); 3305 } 3306 3307 COM_DECLSPEC_NOTHROW 3308 HRESULT 3309 CreateGradientStopCollection( 3310 _In_reads_(gradientStopsCount) CONST D2D1_GRADIENT_STOP *gradientStops, 3311 UINT32 gradientStopsCount, 3312 _Outptr_ ID2D1GradientStopCollection **gradientStopCollection 3313 ) 3314 { 3315 return CreateGradientStopCollection(gradientStops, gradientStopsCount, D2D1_GAMMA_2_2, D2D1_EXTEND_MODE_CLAMP, gradientStopCollection); 3316 } 3317 3318 COM_DECLSPEC_NOTHROW 3319 HRESULT 3320 CreateLinearGradientBrush( 3321 CONST D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES &linearGradientBrushProperties, 3322 _In_ ID2D1GradientStopCollection *gradientStopCollection, 3323 _Outptr_ ID2D1LinearGradientBrush **linearGradientBrush 3324 ) 3325 { 3326 return CreateLinearGradientBrush(&linearGradientBrushProperties, NULL, gradientStopCollection, linearGradientBrush); 3327 } 3328 3329 COM_DECLSPEC_NOTHROW 3330 HRESULT 3331 CreateLinearGradientBrush( 3332 CONST D2D1_LINEAR_GRADIENT_BRUSH_PROPERTIES &linearGradientBrushProperties, 3333 CONST D2D1_BRUSH_PROPERTIES &brushProperties, 3334 _In_ ID2D1GradientStopCollection *gradientStopCollection, 3335 _Outptr_ ID2D1LinearGradientBrush **linearGradientBrush 3336 ) 3337 { 3338 return CreateLinearGradientBrush(&linearGradientBrushProperties, &brushProperties, gradientStopCollection, linearGradientBrush); 3339 } 3340 3341 COM_DECLSPEC_NOTHROW 3342 HRESULT 3343 CreateRadialGradientBrush( 3344 CONST D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES &radialGradientBrushProperties, 3345 _In_ ID2D1GradientStopCollection *gradientStopCollection, 3346 _Outptr_ ID2D1RadialGradientBrush **radialGradientBrush 3347 ) 3348 { 3349 return CreateRadialGradientBrush(&radialGradientBrushProperties, NULL, gradientStopCollection, radialGradientBrush); 3350 } 3351 3352 COM_DECLSPEC_NOTHROW 3353 HRESULT 3354 CreateRadialGradientBrush( 3355 CONST D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES &radialGradientBrushProperties, 3356 CONST D2D1_BRUSH_PROPERTIES &brushProperties, 3357 _In_ ID2D1GradientStopCollection *gradientStopCollection, 3358 _Outptr_ ID2D1RadialGradientBrush **radialGradientBrush 3359 ) 3360 { 3361 return CreateRadialGradientBrush(&radialGradientBrushProperties, &brushProperties, gradientStopCollection, radialGradientBrush); 3362 } 3363 3364 COM_DECLSPEC_NOTHROW 3365 HRESULT 3366 CreateCompatibleRenderTarget( 3367 _Outptr_ ID2D1BitmapRenderTarget **bitmapRenderTarget 3368 ) 3369 { 3370 return CreateCompatibleRenderTarget(NULL, NULL, NULL, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE, bitmapRenderTarget); 3371 } 3372 3373 COM_DECLSPEC_NOTHROW 3374 HRESULT 3375 CreateCompatibleRenderTarget( 3376 D2D1_SIZE_F desiredSize, 3377 _Outptr_ ID2D1BitmapRenderTarget **bitmapRenderTarget 3378 ) 3379 { 3380 return CreateCompatibleRenderTarget(&desiredSize, NULL, NULL, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE, bitmapRenderTarget); 3381 } 3382 3383 COM_DECLSPEC_NOTHROW 3384 HRESULT 3385 CreateCompatibleRenderTarget( 3386 D2D1_SIZE_F desiredSize, 3387 D2D1_SIZE_U desiredPixelSize, 3388 _Outptr_ ID2D1BitmapRenderTarget **bitmapRenderTarget 3389 ) 3390 { 3391 return CreateCompatibleRenderTarget(&desiredSize, &desiredPixelSize, NULL, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE, bitmapRenderTarget); 3392 } 3393 3394 COM_DECLSPEC_NOTHROW 3395 HRESULT 3396 CreateCompatibleRenderTarget( 3397 D2D1_SIZE_F desiredSize, 3398 D2D1_SIZE_U desiredPixelSize, 3399 D2D1_PIXEL_FORMAT desiredFormat, 3400 _Outptr_ ID2D1BitmapRenderTarget **bitmapRenderTarget 3401 ) 3402 { 3403 return CreateCompatibleRenderTarget(&desiredSize, &desiredPixelSize, &desiredFormat, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE, bitmapRenderTarget); 3404 } 3405 3406 COM_DECLSPEC_NOTHROW 3407 HRESULT 3408 CreateCompatibleRenderTarget( 3409 D2D1_SIZE_F desiredSize, 3410 D2D1_SIZE_U desiredPixelSize, 3411 D2D1_PIXEL_FORMAT desiredFormat, 3412 D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS options, 3413 _Outptr_ ID2D1BitmapRenderTarget **bitmapRenderTarget 3414 ) 3415 { 3416 return CreateCompatibleRenderTarget(&desiredSize, &desiredPixelSize, &desiredFormat, options, bitmapRenderTarget); 3417 } 3418 3419 COM_DECLSPEC_NOTHROW 3420 HRESULT 3421 CreateLayer( 3422 D2D1_SIZE_F size, 3423 _Outptr_ ID2D1Layer **layer 3424 ) 3425 { 3426 return CreateLayer(&size, layer); 3427 } 3428 3429 COM_DECLSPEC_NOTHROW 3430 HRESULT 3431 CreateLayer( 3432 _Outptr_ ID2D1Layer **layer 3433 ) 3434 { 3435 return CreateLayer(NULL, layer); 3436 } 3437 3438 COM_DECLSPEC_NOTHROW 3439 void 3440 DrawRectangle( 3441 CONST D2D1_RECT_F &rect, 3442 _In_ ID2D1Brush *brush, 3443 FLOAT strokeWidth = 1.0f, 3444 _In_opt_ ID2D1StrokeStyle *strokeStyle = NULL 3445 ) 3446 { 3447 DrawRectangle(&rect, brush, strokeWidth, strokeStyle); 3448 } 3449 3450 COM_DECLSPEC_NOTHROW 3451 void 3452 FillRectangle( 3453 CONST D2D1_RECT_F &rect, 3454 _In_ ID2D1Brush *brush 3455 ) 3456 { 3457 FillRectangle(&rect, brush); 3458 } 3459 3460 COM_DECLSPEC_NOTHROW 3461 void 3462 DrawRoundedRectangle( 3463 CONST D2D1_ROUNDED_RECT &roundedRect, 3464 _In_ ID2D1Brush *brush, 3465 FLOAT strokeWidth = 1.0f, 3466 _In_opt_ ID2D1StrokeStyle *strokeStyle = NULL 3467 ) 3468 { 3469 DrawRoundedRectangle(&roundedRect, brush, strokeWidth, strokeStyle); 3470 } 3471 3472 COM_DECLSPEC_NOTHROW 3473 void 3474 FillRoundedRectangle( 3475 CONST D2D1_ROUNDED_RECT &roundedRect, 3476 _In_ ID2D1Brush *brush 3477 ) 3478 { 3479 FillRoundedRectangle(&roundedRect, brush); 3480 } 3481 3482 COM_DECLSPEC_NOTHROW 3483 void 3484 DrawEllipse( 3485 CONST D2D1_ELLIPSE &ellipse, 3486 _In_ ID2D1Brush *brush, 3487 FLOAT strokeWidth = 1.0f, 3488 _In_opt_ ID2D1StrokeStyle *strokeStyle = NULL 3489 ) 3490 { 3491 DrawEllipse(&ellipse, brush, strokeWidth, strokeStyle); 3492 } 3493 3494 COM_DECLSPEC_NOTHROW 3495 void 3496 FillEllipse( 3497 CONST D2D1_ELLIPSE &ellipse, 3498 _In_ ID2D1Brush *brush 3499 ) 3500 { 3501 FillEllipse(&ellipse, brush); 3502 } 3503 3504 COM_DECLSPEC_NOTHROW 3505 void 3506 FillOpacityMask( 3507 _In_ ID2D1Bitmap *opacityMask, 3508 _In_ ID2D1Brush *brush, 3509 D2D1_OPACITY_MASK_CONTENT content, 3510 CONST D2D1_RECT_F &destinationRectangle, 3511 CONST D2D1_RECT_F &sourceRectangle 3512 ) 3513 { 3514 FillOpacityMask(opacityMask, brush, content, &destinationRectangle, &sourceRectangle); 3515 } 3516 3517 COM_DECLSPEC_NOTHROW 3518 void 3519 DrawBitmap( 3520 _In_ ID2D1Bitmap *bitmap, 3521 CONST D2D1_RECT_F &destinationRectangle, 3522 FLOAT opacity = 1.0f, 3523 D2D1_BITMAP_INTERPOLATION_MODE interpolationMode = D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, 3524 _In_opt_ CONST D2D1_RECT_F *sourceRectangle = NULL 3525 ) 3526 { 3527 DrawBitmap(bitmap, &destinationRectangle, opacity, interpolationMode, sourceRectangle); 3528 } 3529 3530 COM_DECLSPEC_NOTHROW 3531 void 3532 DrawBitmap( 3533 _In_ ID2D1Bitmap *bitmap, 3534 CONST D2D1_RECT_F &destinationRectangle, 3535 FLOAT opacity, 3536 D2D1_BITMAP_INTERPOLATION_MODE interpolationMode, 3537 CONST D2D1_RECT_F &sourceRectangle 3538 ) 3539 { 3540 DrawBitmap(bitmap, &destinationRectangle, opacity, interpolationMode, &sourceRectangle); 3541 } 3542 3543 COM_DECLSPEC_NOTHROW 3544 void 3545 SetTransform( 3546 CONST D2D1_MATRIX_3X2_F &transform 3547 ) 3548 { 3549 SetTransform(&transform); 3550 } 3551 3552 COM_DECLSPEC_NOTHROW 3553 void 3554 PushLayer( 3555 CONST D2D1_LAYER_PARAMETERS &layerParameters, 3556 _In_opt_ ID2D1Layer *layer 3557 ) 3558 { 3559 PushLayer(&layerParameters, layer); 3560 } 3561 3562 COM_DECLSPEC_NOTHROW 3563 void 3564 PushAxisAlignedClip( 3565 CONST D2D1_RECT_F &clipRect, 3566 D2D1_ANTIALIAS_MODE antialiasMode 3567 ) 3568 { 3569 return PushAxisAlignedClip(&clipRect, antialiasMode); 3570 } 3571 3572 COM_DECLSPEC_NOTHROW 3573 void 3574 Clear( 3575 CONST D2D1_COLOR_F &clearColor 3576 ) 3577 { 3578 return Clear(&clearColor); 3579 } 3580 3581 3582 // 3583 // Draws the text within the given layout rectangle and by default also snaps and 3584 // clips it. 3585 // 3586 COM_DECLSPEC_NOTHROW 3587 void 3588 DrawText( 3589 _In_reads_(stringLength) CONST WCHAR *string, 3590 UINT32 stringLength, 3591 _In_ IDWriteTextFormat *textFormat, 3592 CONST D2D1_RECT_F &layoutRect, 3593 _In_ ID2D1Brush *defaultForegroundBrush, 3594 D2D1_DRAW_TEXT_OPTIONS options = D2D1_DRAW_TEXT_OPTIONS_NONE, 3595 DWRITE_MEASURING_MODE measuringMode = DWRITE_MEASURING_MODE_NATURAL 3596 ) 3597 { 3598 return DrawText(string, stringLength, textFormat, &layoutRect, defaultForegroundBrush, options, measuringMode); 3599 } 3600 3601 COM_DECLSPEC_NOTHROW 3602 BOOL 3603 IsSupported( 3604 CONST D2D1_RENDER_TARGET_PROPERTIES &renderTargetProperties 3605 ) CONST 3606 { 3607 return IsSupported(&renderTargetProperties); 3608 } 3609 */ 3610 3611 // ================================================================= 3612 // HELPER METHODS 3613 3614 version(CORRECT_ABI) {} 3615 else: 3616 3617 // ABI bug workaround for ID2D1RenderTarget.GetPixelFormat() related to return struct by value 3618 public final D2D1_PIXEL_FORMAT GetPixelFormat() const 3619 { 3620 D2D1_PIXEL_FORMAT pFormat; 3621 this.GetPixelFormat(&pFormat); 3622 return pFormat; 3623 } 3624 3625 // ABI bug workaround for ID2D1RenderTarget.GetSize() related to return struct by value 3626 public final D2D1_SIZE_F GetSize() const 3627 { 3628 D2D1_SIZE_F rtSize; 3629 this.GetSize(&rtSize); 3630 return rtSize; 3631 } 3632 3633 // ABI bug workaround for ID2D1RenderTarget.GetPixelSize() related to return struct by value 3634 public final D2D1_SIZE_U GetPixelSize() const 3635 { 3636 D2D1_SIZE_U pSize; 3637 this.GetPixelSize(&pSize); 3638 return pSize; 3639 } 3640 3641 } // interface ID2D1RenderTarget 3642 3643 3644 3645 //+----------------------------------------------------------------------------- 3646 // 3647 // Interface: 3648 // ID2D1BitmapRenderTarget 3649 // 3650 //------------------------------------------------------------------------------ 3651 mixin( uuid!(ID2D1BitmapRenderTarget, "2cd90695-12e2-11dc-9fed-001143a055f9") ); 3652 interface ID2D1BitmapRenderTarget : ID2D1RenderTarget 3653 { 3654 extern(Windows): 3655 HRESULT GetBitmap( 3656 /*out*/ ID2D1Bitmap* bitmap 3657 ); 3658 } // interface ID2D1BitmapRenderTarget 3659 3660 3661 3662 //+----------------------------------------------------------------------------- 3663 // 3664 // Interface: 3665 // ID2D1HwndRenderTarget 3666 // 3667 //------------------------------------------------------------------------------ 3668 mixin( uuid!(ID2D1HwndRenderTarget, "2cd90698-12e2-11dc-9fed-001143a055f9") ); 3669 interface ID2D1HwndRenderTarget : ID2D1RenderTarget 3670 { 3671 extern(Windows): 3672 D2D1_WINDOW_STATE CheckWindowState(); 3673 3674 3675 // 3676 // Resize the buffer underlying the render target. This operation might fail if 3677 // there is insufficient video memory or system memory, or if the render target is 3678 // resized beyond the maximum bitmap size. If the method fails, the render target 3679 // will be placed in a zombie state and D2DERR_RECREATE_TARGET will be returned 3680 // from it when EndDraw is called. In addition an appropriate failure result will 3681 // be returned from Resize. 3682 // 3683 HRESULT Resize( 3684 const(D2D1_SIZE_U)* pixelSize 3685 ); 3686 3687 HWND GetHwnd() const; 3688 3689 /* 3690 COM_DECLSPEC_NOTHROW 3691 HRESULT 3692 Resize( 3693 CONST D2D1_SIZE_U &pixelSize 3694 ) 3695 { 3696 return Resize(&pixelSize); 3697 } 3698 */ 3699 } // interface ID2D1HwndRenderTarget 3700 3701 3702 3703 3704 //+----------------------------------------------------------------------------- 3705 // 3706 // Interface: 3707 // ID2D1GdiInteropRenderTarget 3708 // 3709 //------------------------------------------------------------------------------ 3710 mixin( uuid!(ID2D1GdiInteropRenderTarget, "e0db51c3-6f77-4bae-b3d5-e47509b35838") ); 3711 interface ID2D1GdiInteropRenderTarget : IUnknown 3712 { 3713 extern(Windows): 3714 HRESULT GetDC( 3715 D2D1_DC_INITIALIZE_MODE mode, 3716 /*out*/HDC *hdc 3717 ); 3718 3719 HRESULT ReleaseDC( 3720 const(RECT)* update 3721 ); 3722 } // interface ID2D1GdiInteropRenderTarget 3723 3724 3725 3726 //+----------------------------------------------------------------------------- 3727 // 3728 // Interface: 3729 // ID2D1DCRenderTarget 3730 // 3731 //------------------------------------------------------------------------------ 3732 mixin( uuid!(ID2D1DCRenderTarget, "1c51bc64-de61-46fd-9899-63a5d8f03950") ); 3733 interface ID2D1DCRenderTarget : ID2D1RenderTarget 3734 { 3735 extern(Windows): 3736 HRESULT BindDC( 3737 const HDC hDC, 3738 const(RECT)* pSubRect 3739 ); 3740 } // interface ID2D1DCRenderTarget 3741 3742 3743 3744 //+----------------------------------------------------------------------------- 3745 // 3746 // Interface: 3747 // ID2D1Factory 3748 // 3749 // Synopsis: 3750 // The root factory interface for all of D2D's objects. 3751 // 3752 //------------------------------------------------------------------------------ 3753 mixin( uuid!(ID2D1Factory, "06152247-6f50-465a-9245-118bfd3b6007") ); 3754 interface ID2D1Factory : IUnknown 3755 { 3756 extern(Windows): 3757 3758 // 3759 // Cause the factory to refresh any system metrics that it might have been snapped 3760 // on factory creation. 3761 // 3762 HRESULT ReloadSystemMetrics(); 3763 3764 3765 // 3766 // Retrieves the current desktop DPI. To refresh this, call ReloadSystemMetrics. 3767 // 3768 void GetDesktopDpi( 3769 /*out*/ FLOAT *dpiX, 3770 /*out*/ FLOAT *dpiY 3771 ); 3772 3773 HRESULT CreateRectangleGeometry( 3774 const(D2D1_RECT_F)* rectangle, 3775 /*out*/ ID2D1RectangleGeometry* rectangleGeometry 3776 ); 3777 3778 HRESULT CreateRoundedRectangleGeometry( 3779 const(D2D1_ROUNDED_RECT)* roundedRectangle, 3780 /*out*/ ID2D1RoundedRectangleGeometry* roundedRectangleGeometry 3781 ); 3782 3783 HRESULT CreateEllipseGeometry( 3784 const(D2D1_ELLIPSE)* ellipse, 3785 /*out*/ ID2D1EllipseGeometry* ellipseGeometry 3786 ); 3787 3788 3789 // 3790 // Create a geometry which holds other geometries. 3791 // 3792 HRESULT CreateGeometryGroup( 3793 D2D1_FILL_MODE fillMode, 3794 /*in*/ ID2D1Geometry *geometries, 3795 UINT32 geometriesCount, 3796 /*out*/ ID2D1GeometryGroup *geometryGroup 3797 ); 3798 3799 HRESULT CreateTransformedGeometry( 3800 ID2D1Geometry sourceGeometry, 3801 const(D2D1_MATRIX_3X2_F)* transform, 3802 /*out*/ ID2D1TransformedGeometry* transformedGeometry 3803 ); 3804 3805 3806 // 3807 // Returns an initially empty path geometry interface. A geometry sink is created 3808 // off the interface to populate it. 3809 // 3810 HRESULT CreatePathGeometry( 3811 /*out*/ ID2D1PathGeometry* pathGeometry 3812 ); 3813 3814 3815 // 3816 // Allows a non-default stroke style to be specified for a given geometry at draw 3817 // time. 3818 // 3819 HRESULT CreateStrokeStyle( 3820 const(D2D1_STROKE_STYLE_PROPERTIES)* strokeStyleProperties, 3821 const(FLOAT)* dashes, 3822 UINT32 dashesCount, 3823 /*out*/ ID2D1StrokeStyle* strokeStyle 3824 ); 3825 3826 3827 // 3828 // Creates a new drawing state block, this can be used in subsequent 3829 // SaveDrawingState and RestoreDrawingState operations on the render target. 3830 // 3831 HRESULT CreateDrawingStateBlock( 3832 const(D2D1_DRAWING_STATE_DESCRIPTION)* drawingStateDescription, 3833 IDWriteRenderingParams textRenderingParams, 3834 /*out*/ ID2D1DrawingStateBlock* drawingStateBlock 3835 ); 3836 3837 3838 // 3839 // Creates a render target which is a source of bitmaps. 3840 // 3841 version(WinCodec) 3842 HRESULT CreateWicBitmapRenderTarget( 3843 IWICBitmap target, 3844 const(D2D1_RENDER_TARGET_PROPERTIES)* renderTargetProperties, 3845 /*out*/ ID2D1RenderTarget* renderTarget 3846 ); 3847 3848 3849 // 3850 // Creates a render target that appears on the display. 3851 // 3852 HRESULT CreateHwndRenderTarget( 3853 const(D2D1_RENDER_TARGET_PROPERTIES)* renderTargetProperties, 3854 const(D2D1_HWND_RENDER_TARGET_PROPERTIES)* hwndRenderTargetProperties, 3855 /*out*/ ID2D1HwndRenderTarget* hwndRenderTarget 3856 ); 3857 3858 3859 // 3860 // Creates a render target that draws to a DXGI Surface. The device that owns the 3861 // surface is used for rendering. 3862 // 3863 HRESULT CreateDxgiSurfaceRenderTarget( 3864 IDXGISurface dxgiSurface, 3865 const(D2D1_RENDER_TARGET_PROPERTIES)* renderTargetProperties, 3866 /*out*/ ID2D1RenderTarget* renderTarget 3867 ); 3868 3869 3870 // 3871 // Creates a render target that draws to a GDI device context. 3872 // 3873 HRESULT CreateDCRenderTarget( 3874 const(D2D1_RENDER_TARGET_PROPERTIES)* renderTargetProperties, 3875 /*out*/ ID2D1DCRenderTarget* dcRenderTarget 3876 ); 3877 3878 /* 3879 COM_DECLSPEC_NOTHROW 3880 HRESULT 3881 CreateRectangleGeometry( 3882 CONST D2D1_RECT_F &rectangle, 3883 _Outptr_ ID2D1RectangleGeometry **rectangleGeometry 3884 ) 3885 { 3886 return CreateRectangleGeometry(&rectangle, rectangleGeometry); 3887 } 3888 3889 COM_DECLSPEC_NOTHROW 3890 HRESULT 3891 CreateRoundedRectangleGeometry( 3892 CONST D2D1_ROUNDED_RECT &roundedRectangle, 3893 _Outptr_ ID2D1RoundedRectangleGeometry **roundedRectangleGeometry 3894 ) 3895 { 3896 return CreateRoundedRectangleGeometry(&roundedRectangle, roundedRectangleGeometry); 3897 } 3898 3899 COM_DECLSPEC_NOTHROW 3900 HRESULT 3901 CreateEllipseGeometry( 3902 CONST D2D1_ELLIPSE &ellipse, 3903 _Outptr_ ID2D1EllipseGeometry **ellipseGeometry 3904 ) 3905 { 3906 return CreateEllipseGeometry(&ellipse, ellipseGeometry); 3907 } 3908 3909 COM_DECLSPEC_NOTHROW 3910 HRESULT 3911 CreateTransformedGeometry( 3912 _In_ ID2D1Geometry *sourceGeometry, 3913 CONST D2D1_MATRIX_3X2_F &transform, 3914 _Outptr_ ID2D1TransformedGeometry **transformedGeometry 3915 ) 3916 { 3917 return CreateTransformedGeometry(sourceGeometry, &transform, transformedGeometry); 3918 } 3919 3920 COM_DECLSPEC_NOTHROW 3921 HRESULT 3922 CreateStrokeStyle( 3923 CONST D2D1_STROKE_STYLE_PROPERTIES &strokeStyleProperties, 3924 _In_reads_opt_(dashesCount) CONST FLOAT *dashes, 3925 UINT32 dashesCount, 3926 _Outptr_ ID2D1StrokeStyle **strokeStyle 3927 ) 3928 { 3929 return CreateStrokeStyle(&strokeStyleProperties, dashes, dashesCount, strokeStyle); 3930 } 3931 3932 COM_DECLSPEC_NOTHROW 3933 HRESULT 3934 CreateDrawingStateBlock( 3935 CONST D2D1_DRAWING_STATE_DESCRIPTION &drawingStateDescription, 3936 _Outptr_ ID2D1DrawingStateBlock **drawingStateBlock 3937 ) 3938 { 3939 return CreateDrawingStateBlock(&drawingStateDescription, NULL, drawingStateBlock); 3940 } 3941 3942 COM_DECLSPEC_NOTHROW 3943 HRESULT 3944 CreateDrawingStateBlock( 3945 _Outptr_ ID2D1DrawingStateBlock **drawingStateBlock 3946 ) 3947 { 3948 return CreateDrawingStateBlock(NULL, NULL, drawingStateBlock); 3949 } 3950 3951 COM_DECLSPEC_NOTHROW 3952 HRESULT 3953 CreateWicBitmapRenderTarget( 3954 _In_ IWICBitmap *target, 3955 CONST D2D1_RENDER_TARGET_PROPERTIES &renderTargetProperties, 3956 _Outptr_ ID2D1RenderTarget **renderTarget 3957 ) 3958 { 3959 return CreateWicBitmapRenderTarget(target, &renderTargetProperties, renderTarget); 3960 } 3961 3962 COM_DECLSPEC_NOTHROW 3963 HRESULT 3964 CreateHwndRenderTarget( 3965 CONST D2D1_RENDER_TARGET_PROPERTIES &renderTargetProperties, 3966 CONST D2D1_HWND_RENDER_TARGET_PROPERTIES &hwndRenderTargetProperties, 3967 _Outptr_ ID2D1HwndRenderTarget **hwndRenderTarget 3968 ) 3969 { 3970 return CreateHwndRenderTarget(&renderTargetProperties, &hwndRenderTargetProperties, hwndRenderTarget); 3971 } 3972 3973 COM_DECLSPEC_NOTHROW 3974 HRESULT 3975 CreateDxgiSurfaceRenderTarget( 3976 _In_ IDXGISurface *dxgiSurface, 3977 CONST D2D1_RENDER_TARGET_PROPERTIES &renderTargetProperties, 3978 _Outptr_ ID2D1RenderTarget **renderTarget 3979 ) 3980 { 3981 return CreateDxgiSurfaceRenderTarget(dxgiSurface, &renderTargetProperties, renderTarget); 3982 } 3983 */ 3984 } // interface ID2D1Factory 3985 3986 //__gshared _D2D1CreateFactory D2D1CreateFactory; 3987 //__gshared _D2D1MakeRotateMatrix D2D1MakeRotateMatrix; 3988 //__gshared _D2D1MakeSkewMatrix D2D1MakeSkewMatrix; 3989 //__gshared _D2D1IsMatrixInvertible D2D1IsMatrixInvertible; 3990 //__gshared _D2D1InvertMatrix D2D1InvertMatrix; 3991 3992 extern(Windows) 3993 HRESULT D2D1CreateFactory(D2D1_FACTORY_TYPE factoryType, 3994 REFIID riid, 3995 const(D2D1_FACTORY_OPTIONS)* pFactoryOptions, 3996 /*out*/ void **ppIFactory); 3997 extern(Windows) 3998 void D2D1MakeRotateMatrix(FLOAT angle, 3999 D2D1_POINT_2F center, 4000 /*out*/ D2D1_MATRIX_3X2_F *matrix); 4001 4002 4003 extern(Windows) 4004 void D2D1MakeSkewMatrix(FLOAT angleX, 4005 FLOAT angleY, 4006 D2D1_POINT_2F center, 4007 /*out*/ D2D1_MATRIX_3X2_F *matrix); 4008 4009 extern(Windows) 4010 BOOL D2D1IsMatrixInvertible(const(D2D1_MATRIX_3X2_F)* matrix); 4011 4012 extern(Windows) 4013 BOOL D2D1InvertMatrix(/*inout*/ D2D1_MATRIX_3X2_F* matrix); 4014 4015 // TODO: should this extern be removed? 4016 extern(Windows) { 4017 // 4018 // This export cannot be in a namespace because compiler name mangling isn't consistent 4019 // also, this must be 'C' callable. 4020 // 4021 alias _D2D1CreateFactory = extern(Windows) HRESULT function(D2D1_FACTORY_TYPE factoryType, 4022 REFIID riid, 4023 const(D2D1_FACTORY_OPTIONS)* pFactoryOptions, 4024 /*out*/ void **ppIFactory); 4025 4026 alias _D2D1MakeRotateMatrix = extern(Windows) void function(FLOAT angle, 4027 D2D1_POINT_2F center, 4028 /*out*/ D2D1_MATRIX_3X2_F *matrix); 4029 4030 alias _D2D1MakeSkewMatrix = extern(Windows) void function(FLOAT angleX, 4031 FLOAT angleY, 4032 D2D1_POINT_2F center, 4033 /*out*/ D2D1_MATRIX_3X2_F *matrix); 4034 4035 alias _D2D1IsMatrixInvertible = extern(Windows) BOOL function(const(D2D1_MATRIX_3X2_F)* matrix); 4036 4037 alias _D2D1InvertMatrix = extern(Windows) BOOL function(/*inout*/ D2D1_MATRIX_3X2_F* matrix); 4038 } 4039 /+ 4040 HRESULT 4041 D2D1CreateFactory( 4042 D2D1_FACTORY_TYPE factoryType, 4043 REFIID riid, 4044 /*out*/ void **factory 4045 ) 4046 { 4047 return 4048 D2D1CreateFactory( 4049 factoryType, 4050 riid, 4051 null, 4052 factory); 4053 } 4054 4055 4056 HRESULT 4057 D2D1CreateFactory(Factory)( 4058 D2D1_FACTORY_TYPE factoryType, 4059 /*out*/ Factory* factory 4060 ) 4061 { 4062 return 4063 D2D1CreateFactory( 4064 factoryType, 4065 mixin("&IID_"~Factory.stringof), 4066 cast(void**)factory); 4067 } 4068 4069 HRESULT 4070 D2D1CreateFactory(Factory)( 4071 D2D1_FACTORY_TYPE factoryType, 4072 const(D2D1_FACTORY_OPTIONS)* factoryOptions, 4073 /*out*/ Factory* ppFactory 4074 ) 4075 { 4076 return 4077 D2D1CreateFactory( 4078 factoryType, 4079 mixin("IID_"~Factory.stringof), 4080 factoryOptions, 4081 cast(void**)ppFactory); 4082 } 4083 +/ 4084 4085 4086 // ---------- EXTENSION METHODS 4087 4088 HRESULT 4089 CreateSolidColorBrush( 4090 ID2D1RenderTarget rt, 4091 const(D2D1_COLOR_F) color, 4092 /+out+/ ID2D1SolidColorBrush* solidColorBrush 4093 ) 4094 { 4095 return rt.CreateSolidColorBrush(&color, null, solidColorBrush); 4096 } 4097 4098 HRESULT 4099 CreateSolidColorBrush( 4100 ID2D1HwndRenderTarget hrt, 4101 const(D2D1_COLOR_F) color, 4102 /+out+/ ID2D1SolidColorBrush* solidColorBrush 4103 ) 4104 { 4105 return hrt.CreateSolidColorBrush(&color, null, solidColorBrush); 4106 }